[gtk/clipboard-test] Fix clipboard tests under xvfb
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/clipboard-test] Fix clipboard tests under xvfb
- Date: Tue, 27 Apr 2021 02:17:21 +0000 (UTC)
commit e7dc3674d2916635dceacb19981c5f4a557e925c
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 26 22:16:54 2021 -0400
Fix clipboard tests under xvfb
testsuite/gdk/clipboard-client.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/testsuite/gdk/clipboard-client.c b/testsuite/gdk/clipboard-client.c
index 88ae607358..b7f70d4912 100644
--- a/testsuite/gdk/clipboard-client.c
+++ b/testsuite/gdk/clipboard-client.c
@@ -1,5 +1,9 @@
#include <gtk/gtk.h>
+#ifdef GDK_WINDOWING_WAYLAND
+#include "wayland/gdkwayland.h"
+#endif
+
static void
got_text_cb (GObject *source,
GAsyncResult *result,
@@ -177,11 +181,19 @@ main (int argc, char *argv[])
gtk_init ();
- window = gtk_window_new ();
-
- gtk_window_present (GTK_WINDOW (window));
-
- g_signal_connect (window, "notify::is-active", G_CALLBACK (do_it), NULL);
+ /* Don't wait for a window manager to give us focus when
+ * we may be running on bare wm-less X.
+ */
+#ifdef GDK_WINDOWING_WAYLAND
+ if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
+ {
+ window = gtk_window_new ();
+ gtk_window_present (GTK_WINDOW (window));
+ g_signal_connect (window, "notify::is-active", G_CALLBACK (do_it), NULL);
+ }
+ else
+#endif
+ do_it (NULL, NULL);
while (!done)
g_main_context_iteration (NULL, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]