[mutter] tests: Don't rely on latency for actually showing Wayland windows
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests: Don't rely on latency for actually showing Wayland windows
- Date: Wed, 23 Dec 2015 07:31:17 +0000 (UTC)
commit 5054b2a99c3b06146c0ae75f7ce875ac5f5a4972
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Sep 8 16:03:45 2015 +0800
tests: Don't rely on latency for actually showing Wayland windows
The test runner sends a "show" command to the test clients and assumes
this was enough work done by the client to enable the compositor to map
the window. Now that we wait to show a Wayland window until the first
buffer is attached (see bug 750552), we need to make sure that we attach
a buffer before assuming that we have the final stacking order.
So, to in order to continue relying on "show" to be enough to actually
show a window, let the test client wait until it has drawn the first
frame.
This makes the tests using Wayland clients test non-flaky.
https://bugzilla.gnome.org/show_bug.cgi?id=754711
src/tests/test-client.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/test-client.c b/src/tests/test-client.c
index 4c4480c..7e24ab2 100644
--- a/src/tests/test-client.c
+++ b/src/tests/test-client.c
@@ -42,6 +42,16 @@ lookup_window (const char *window_id)
}
static void
+on_after_paint (GdkFrameClock *clock,
+ GMainLoop *loop)
+{
+ g_signal_handlers_disconnect_by_func (clock,
+ (gpointer) on_after_paint,
+ loop);
+ g_main_loop_quit (loop);
+}
+
+static void
process_line (const char *line)
{
GError *error = NULL;
@@ -135,10 +145,25 @@ process_line (const char *line)
}
GtkWidget *window = lookup_window (argv[1]);
+ GdkWindow *gdk_window = gtk_widget_get_window (window);
if (!window)
goto out;
gtk_widget_show (window);
+
+ /* When a Wayland client, we cannot be really sure that the window has
+ * been mappable until after we have painted. So, in order to have the
+ * test runner rely on the "show" command to have done what the client
+ * needs to do in order for a window to be mappable compositor side, lets
+ * wait with returning until after the first frame.
+ */
+ GdkFrameClock *frame_clock = gdk_window_get_frame_clock (gdk_window);
+ GMainLoop *loop = g_main_loop_new (NULL, FALSE);
+ g_signal_connect (frame_clock, "after-paint",
+ G_CALLBACK (on_after_paint),
+ loop);
+ g_main_loop_run (loop);
+ g_main_loop_unref (loop);
}
else if (strcmp (argv[0], "hide") == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]