mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
tests/wayland-unit: Move out sync point wait helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2624>
This commit is contained in:
parent
7972594d26
commit
41f488a65c
@ -331,3 +331,28 @@ meta_wayland_test_driver_set_property (MetaWaylandTestDriver *test_driver,
|
||||
g_strdup (name),
|
||||
g_strdup (value));
|
||||
}
|
||||
|
||||
static void
|
||||
on_sync_point (MetaWaylandTestDriver *test_driver,
|
||||
unsigned int sequence,
|
||||
struct wl_resource *surface_resource,
|
||||
struct wl_client *wl_client,
|
||||
unsigned int *latest_sequence)
|
||||
{
|
||||
*latest_sequence = sequence;
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_test_driver_wait_for_sync_point (MetaWaylandTestDriver *test_driver,
|
||||
unsigned int sync_point)
|
||||
{
|
||||
gulong handler_id;
|
||||
unsigned int latest_sequence = sync_point - 1;
|
||||
|
||||
handler_id = g_signal_connect (test_driver, "sync-point",
|
||||
G_CALLBACK (on_sync_point),
|
||||
&latest_sequence);
|
||||
while (latest_sequence != sync_point)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
g_signal_handler_disconnect (test_driver, handler_id);
|
||||
}
|
||||
|
@ -34,4 +34,7 @@ void meta_wayland_test_driver_set_property (MetaWaylandTestDriver *test_driver,
|
||||
const char *name,
|
||||
const char *value);
|
||||
|
||||
void meta_wayland_test_driver_wait_for_sync_point (MetaWaylandTestDriver *test_driver,
|
||||
unsigned int sync_point);
|
||||
|
||||
#endif /* META_WAYLAND_TEST_DRIVER_H */
|
||||
|
@ -385,28 +385,10 @@ toplevel_activation (void)
|
||||
meta_wayland_test_client_finish (data.wayland_test_client);
|
||||
}
|
||||
|
||||
static void
|
||||
on_sync_point (MetaWaylandTestDriver *test_driver,
|
||||
unsigned int sequence,
|
||||
struct wl_resource *surface_resource,
|
||||
struct wl_client *wl_client,
|
||||
unsigned int *latest_sequence)
|
||||
{
|
||||
*latest_sequence = sequence;
|
||||
}
|
||||
|
||||
static void
|
||||
wait_for_sync_point (unsigned int sync_point)
|
||||
{
|
||||
gulong handler_id;
|
||||
unsigned int latest_sequence = 0;
|
||||
|
||||
handler_id = g_signal_connect (test_driver, "sync-point",
|
||||
G_CALLBACK (on_sync_point),
|
||||
&latest_sequence);
|
||||
while (latest_sequence != sync_point)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
g_signal_handler_disconnect (test_driver, handler_id);
|
||||
meta_wayland_test_driver_wait_for_sync_point (test_driver, sync_point);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user