mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 21:32:14 +00:00
tests/wayland-test-client-utils: Add helper to wait for event
Useful for synchronization. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
This commit is contained in:
parent
aa0b1fbc88
commit
d97c160122
@ -446,3 +446,27 @@ wait_for_view_verified (WaylandDisplay *display,
|
||||
g_error ("%s: Failed to dispatch Wayland display", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_sync_event (WaylandDisplay *display,
|
||||
uint32_t serial,
|
||||
uint32_t *expected_serial)
|
||||
{
|
||||
g_assert_cmpuint (serial, ==, *expected_serial);
|
||||
*expected_serial = serial + 1;
|
||||
}
|
||||
|
||||
void
|
||||
wait_for_sync_event (WaylandDisplay *display,
|
||||
uint32_t serial)
|
||||
{
|
||||
uint32_t expected_serial = serial;
|
||||
|
||||
g_signal_connect (display, "sync-event", G_CALLBACK (on_sync_event),
|
||||
&expected_serial);
|
||||
while (expected_serial != serial + 1)
|
||||
{
|
||||
if (wl_display_dispatch (display->display) == -1)
|
||||
g_error ("%s: Failed to dispatch Wayland display", __func__);
|
||||
}
|
||||
}
|
||||
|
@ -66,4 +66,7 @@ void wait_for_effects_completed (WaylandDisplay *display,
|
||||
void wait_for_view_verified (WaylandDisplay *display,
|
||||
int sequence);
|
||||
|
||||
void wait_for_sync_event (WaylandDisplay *display,
|
||||
uint32_t serial);
|
||||
|
||||
#endif /* WAYLAND_TEST_CLIENT_UTILS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user