fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0001-a11y-Check-X11-display-at-runtime.patch

1a94a7
From 6b91ab848b86aa7968bb421f2f3f30b1c8ad6ba2 Mon Sep 17 00:00:00 2001
1a94a7
From: Olivier Fourdan <ofourdan@redhat.com>
1a94a7
Date: Mon, 10 Dec 2018 17:05:53 +0100
1a94a7
Subject: [PATCH] a11y: Check X11 display at runtime
1a94a7
1a94a7
`gtk_widget_accessible_grab_focus()` code checks that X11 isenabled at
1a94a7
build time and uses X11 specific functions such as
1a94a7
`gdk_x11_get_server_time()` regardless of the actual backend being used.
1a94a7
1a94a7
Check that we are using an X11 display when X11 is backend enabled, so
1a94a7
we do not crash when running on Wayland
1a94a7
1a94a7
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1507
1a94a7
---
1a94a7
 gtk/a11y/gtkwidgetaccessible.c | 9 +++++----
1a94a7
 1 file changed, 5 insertions(+), 4 deletions(-)
1a94a7
1a94a7
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
1a94a7
index 2154e88239..b1b866c39c 100644
1a94a7
--- a/gtk/a11y/gtkwidgetaccessible.c
1a94a7
+++ b/gtk/a11y/gtkwidgetaccessible.c
1a94a7
@@ -648,11 +648,12 @@ gtk_widget_accessible_grab_focus (AtkComponent *component)
1a94a7
   if (gtk_widget_is_toplevel (toplevel))
1a94a7
     {
1a94a7
 #ifdef GDK_WINDOWING_X11
1a94a7
-      gtk_window_present_with_time (GTK_WINDOW (toplevel),
1a94a7
-      gdk_x11_get_server_time (gtk_widget_get_window (widget)));
1a94a7
-#else
1a94a7
-      gtk_window_present (GTK_WINDOW (toplevel));
1a94a7
+      if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (toplevel)))
1a94a7
+        gtk_window_present_with_time (GTK_WINDOW (toplevel),
1a94a7
+                                      gdk_x11_get_server_time (gtk_widget_get_window (widget)));
1a94a7
+      else
1a94a7
 #endif
1a94a7
+        gtk_window_present (GTK_WINDOW (toplevel));
1a94a7
     }
1a94a7
   return TRUE;
1a94a7
 }
1a94a7
-- 
1a94a7
2.19.2
1a94a7