[gtk+/gtk-3-22] gdk/wayland: Restrict shortcut inhibition to keyboard grabs on toplevels



commit e7e047fc3fa7ae0fc9909e6dff00810973c1d3c2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Oct 26 12:09:44 2017 +0200

    gdk/wayland: Restrict shortcut inhibition to keyboard grabs on toplevels
    
    It is unlikely that popup windows will contain anything that requires this
    (popup menus being more interested in redirecting keyboard focus to
    themselves). OTOH popup implementations that just grab the keyboard are
    commonplace enough, it makes sense not to trigger inhibition for these.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789268

 gdk/wayland/gdkdevice-wayland.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 7babcc0..0f2afd0 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -756,8 +756,12 @@ gdk_wayland_device_grab (GdkDevice    *device,
   if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
     {
       /* Device is a keyboard */
-      gdk_wayland_window_inhibit_shortcuts (window,
-                                            gdk_device_get_seat (device));
+      if (gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL)
+        {
+          gdk_wayland_window_inhibit_shortcuts (window,
+                                                gdk_device_get_seat (device));
+        }
+
       return GDK_GRAB_SUCCESS;
     }
   else
@@ -4787,8 +4791,9 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
                                     evtime,
                                     FALSE);
 
-      /* Inhibit shortcuts if the seat grab is for the keyboard only */
-      if (capabilities == GDK_SEAT_CAPABILITY_KEYBOARD)
+      /* Inhibit shortcuts on toplevels if the seat grab is for the keyboard only */
+      if (capabilities == GDK_SEAT_CAPABILITY_KEYBOARD &&
+          native->window_type == GDK_WINDOW_TOPLEVEL)
         gdk_wayland_window_inhibit_shortcuts (window, seat);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]