mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 10:30:47 -05:00
tests/runner: Move window shown synchronization to helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
This commit is contained in:
parent
c9a05d4581
commit
8cb0646b62
@ -342,39 +342,6 @@ test_case_check_xserver_stacking (TestCase *test,
|
||||
return *error == NULL;
|
||||
}
|
||||
|
||||
typedef struct _WaitForShownData
|
||||
{
|
||||
GMainLoop *loop;
|
||||
MetaWindow *window;
|
||||
guint shown_handler_id;
|
||||
} WaitForShownData;
|
||||
|
||||
static void
|
||||
on_window_shown (MetaWindow *window,
|
||||
WaitForShownData *data)
|
||||
{
|
||||
g_main_loop_quit (data->loop);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
test_case_wait_for_showing_before_redraw (gpointer user_data)
|
||||
{
|
||||
WaitForShownData *data = user_data;
|
||||
|
||||
if (meta_window_is_hidden (data->window))
|
||||
{
|
||||
data->shown_handler_id = g_signal_connect (data->window, "shown",
|
||||
G_CALLBACK (on_window_shown),
|
||||
data);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_main_loop_quit (data->loop);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
test_case_do (TestCase *test,
|
||||
int argc,
|
||||
@ -533,18 +500,7 @@ test_case_do (TestCase *test,
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
WaitForShownData data = {
|
||||
.loop = g_main_loop_new (NULL, FALSE),
|
||||
.window = window,
|
||||
};
|
||||
meta_later_add (META_LATER_BEFORE_REDRAW,
|
||||
test_case_wait_for_showing_before_redraw,
|
||||
&data,
|
||||
NULL);
|
||||
g_main_loop_run (data.loop);
|
||||
if (data.shown_handler_id)
|
||||
g_signal_handler_disconnect (window, data.shown_handler_id);
|
||||
g_main_loop_unref (data.loop);
|
||||
test_client_wait_for_window_shown (client, window);
|
||||
}
|
||||
else if (strcmp (argv[0], "hide") == 0 ||
|
||||
strcmp (argv[0], "activate") == 0 ||
|
||||
|
@ -359,6 +359,57 @@ test_client_find_window (TestClient *client,
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef struct _WaitForShownData
|
||||
{
|
||||
GMainLoop *loop;
|
||||
MetaWindow *window;
|
||||
guint shown_handler_id;
|
||||
} WaitForShownData;
|
||||
|
||||
static void
|
||||
on_window_shown (MetaWindow *window,
|
||||
WaitForShownData *data)
|
||||
{
|
||||
g_main_loop_quit (data->loop);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wait_for_showing_before_redraw (gpointer user_data)
|
||||
{
|
||||
WaitForShownData *data = user_data;
|
||||
|
||||
if (meta_window_is_hidden (data->window))
|
||||
{
|
||||
data->shown_handler_id = g_signal_connect (data->window, "shown",
|
||||
G_CALLBACK (on_window_shown),
|
||||
data);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_main_loop_quit (data->loop);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
test_client_wait_for_window_shown (TestClient *client,
|
||||
MetaWindow *window)
|
||||
{
|
||||
WaitForShownData data = {
|
||||
.loop = g_main_loop_new (NULL, FALSE),
|
||||
.window = window,
|
||||
};
|
||||
meta_later_add (META_LATER_BEFORE_REDRAW,
|
||||
wait_for_showing_before_redraw,
|
||||
&data,
|
||||
NULL);
|
||||
g_main_loop_run (data.loop);
|
||||
if (data.shown_handler_id)
|
||||
g_signal_handler_disconnect (window, data.shown_handler_id);
|
||||
g_main_loop_unref (data.loop);
|
||||
}
|
||||
|
||||
gboolean
|
||||
test_client_alarm_filter (MetaX11Display *x11_display,
|
||||
XSyncAlarmNotifyEvent *event,
|
||||
|
@ -70,6 +70,9 @@ MetaWindow * test_client_find_window (TestClient *client,
|
||||
const char *window_id,
|
||||
GError **error);
|
||||
|
||||
void test_client_wait_for_window_shown (TestClient *client,
|
||||
MetaWindow *window);
|
||||
|
||||
gboolean test_client_quit (TestClient *client,
|
||||
GError **error);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user