tests/wayland-test-driver: Add sync event
Will be used to signal test cases. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
This commit is contained in:
parent
a1d5c96e86
commit
ed4e532690
@ -40,6 +40,8 @@ struct _MetaWaylandTestDriver
|
|||||||
GObject parent;
|
GObject parent;
|
||||||
|
|
||||||
struct wl_global *test_driver;
|
struct wl_global *test_driver;
|
||||||
|
|
||||||
|
GList *resources;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaWaylandTestDriver, meta_wayland_test_driver,
|
G_DEFINE_TYPE (MetaWaylandTestDriver, meta_wayland_test_driver,
|
||||||
@ -97,6 +99,14 @@ static const struct test_driver_interface meta_test_driver_interface = {
|
|||||||
sync_point,
|
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
|
static void
|
||||||
bind_test_driver (struct wl_client *client,
|
bind_test_driver (struct wl_client *client,
|
||||||
void *user_data,
|
void *user_data,
|
||||||
@ -109,7 +119,9 @@ bind_test_driver (struct wl_client *client,
|
|||||||
resource = wl_resource_create (client, &test_driver_interface,
|
resource = wl_resource_create (client, &test_driver_interface,
|
||||||
version, id);
|
version, id);
|
||||||
wl_resource_set_implementation (resource, &meta_test_driver_interface,
|
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
|
static void
|
||||||
@ -161,3 +173,17 @@ meta_wayland_test_driver_new (MetaWaylandCompositor *compositor)
|
|||||||
|
|
||||||
return test_driver;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -27,4 +27,7 @@ G_DECLARE_FINAL_TYPE (MetaWaylandTestDriver, meta_wayland_test_driver,
|
|||||||
|
|
||||||
MetaWaylandTestDriver * meta_wayland_test_driver_new (MetaWaylandCompositor *compositor);
|
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 */
|
#endif /* META_WAYLAND_TEST_DRIVER_H */
|
||||||
|
@ -10,5 +10,9 @@
|
|||||||
<arg name="sequence" type="uint"/>
|
<arg name="sequence" type="uint"/>
|
||||||
<arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
|
<arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<event name="sync_event">
|
||||||
|
<arg name="sequence" type="uint"/>
|
||||||
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
Reference in New Issue
Block a user