diff --git a/src/tests/meta-wayland-test-driver.c b/src/tests/meta-wayland-test-driver.c index 24ce06030..e8413e0b8 100644 --- a/src/tests/meta-wayland-test-driver.c +++ b/src/tests/meta-wayland-test-driver.c @@ -40,6 +40,8 @@ struct _MetaWaylandTestDriver GObject parent; struct wl_global *test_driver; + + GList *resources; }; G_DEFINE_TYPE (MetaWaylandTestDriver, meta_wayland_test_driver, @@ -97,6 +99,14 @@ static const struct test_driver_interface meta_test_driver_interface = { sync_point, }; +static void +test_driver_destructor (struct wl_resource *resource) +{ + MetaWaylandTestDriver *test_driver = wl_resource_get_user_data (resource); + + test_driver->resources = g_list_remove (test_driver->resources, resource); +} + static void bind_test_driver (struct wl_client *client, void *user_data, @@ -109,7 +119,9 @@ bind_test_driver (struct wl_client *client, resource = wl_resource_create (client, &test_driver_interface, version, id); wl_resource_set_implementation (resource, &meta_test_driver_interface, - test_driver, NULL); + test_driver, test_driver_destructor); + + test_driver->resources = g_list_prepend (test_driver->resources, resource); } static void @@ -161,3 +173,17 @@ meta_wayland_test_driver_new (MetaWaylandCompositor *compositor) return test_driver; } + +void +meta_wayland_test_driver_emit_sync_event (MetaWaylandTestDriver *test_driver, + uint32_t serial) +{ + GList *l; + + for (l = test_driver->resources; l; l = l->next) + { + struct wl_resource *resource = l->data; + + test_driver_send_sync_event (resource, serial); + } +} diff --git a/src/tests/meta-wayland-test-driver.h b/src/tests/meta-wayland-test-driver.h index ccbfe1312..6d357650c 100644 --- a/src/tests/meta-wayland-test-driver.h +++ b/src/tests/meta-wayland-test-driver.h @@ -27,4 +27,7 @@ G_DECLARE_FINAL_TYPE (MetaWaylandTestDriver, meta_wayland_test_driver, MetaWaylandTestDriver * meta_wayland_test_driver_new (MetaWaylandCompositor *compositor); +void meta_wayland_test_driver_emit_sync_event (MetaWaylandTestDriver *test_driver, + uint32_t serial); + #endif /* META_WAYLAND_TEST_DRIVER_H */ diff --git a/src/tests/wayland-test-clients/test-driver.xml b/src/tests/wayland-test-clients/test-driver.xml index 27574b101..763e1f674 100644 --- a/src/tests/wayland-test-clients/test-driver.xml +++ b/src/tests/wayland-test-clients/test-driver.xml @@ -10,5 +10,9 @@ + + + +