diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.c b/src/tests/wayland-test-clients/wayland-test-client-utils.c index 97d28b8e1..a964d4c38 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.c +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.c @@ -553,23 +553,24 @@ wait_for_view_verified (WaylandDisplay *display, static void on_sync_event (WaylandDisplay *display, uint32_t serial, - uint32_t *expected_serial) + void *user_data) { - g_assert_cmpuint (serial, ==, *expected_serial); - *expected_serial = serial + 1; + g_assert_cmpuint (serial, ==, display->sync_event_serial_next); + display->sync_event_serial_next = serial + 1; } void wait_for_sync_event (WaylandDisplay *display, - uint32_t serial) + uint32_t expected_serial) { - uint32_t expected_serial = serial; + gulong handler_id; + handler_id = g_signal_connect (display, "sync-event", G_CALLBACK (on_sync_event), NULL); - g_signal_connect (display, "sync-event", G_CALLBACK (on_sync_event), - &expected_serial); - while (expected_serial != serial + 1) + while (expected_serial + 1 > display->sync_event_serial_next) { if (wl_display_dispatch (display->display) == -1) g_error ("%s: Failed to dispatch Wayland display", __func__); } + + g_signal_handler_disconnect (display, handler_id); } diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.h b/src/tests/wayland-test-clients/wayland-test-client-utils.h index 332964938..6451f369f 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.h +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.h @@ -34,6 +34,8 @@ typedef struct _WaylandDisplay struct xdg_wm_base *xdg_wm_base; struct test_driver *test_driver; + uint32_t sync_event_serial_next; + GHashTable *properties; } WaylandDisplay; diff --git a/src/tests/wayland-x11-interop-tests.c b/src/tests/wayland-x11-interop-tests.c index 2ea87d7aa..6141bb79d 100644 --- a/src/tests/wayland-x11-interop-tests.c +++ b/src/tests/wayland-x11-interop-tests.c @@ -185,7 +185,7 @@ service_client_thread_func (gpointer user_data) data->xwindow); wl_surface_commit (surface->wl_surface); - wait_for_sync_event (display, 1); + wait_for_sync_event (display, 0); mutter_x11_interop_destroy (x11_interop); g_object_unref (display); @@ -231,7 +231,7 @@ meta_test_wayland_client_x11_interop_x11_parent (void) g_assert_true (meta_window_get_transient_for (wayland_window) == x11_window); - meta_wayland_test_driver_emit_sync_event (test_driver, 1); + meta_wayland_test_driver_emit_sync_event (test_driver, 0); g_debug ("Waiting for client to disconnect"); while (!g_atomic_int_get (&data.client_terminated))