[mutter] keybindings: Move common window grab code out of X-only if statement



commit aba0b9ef643a14d6187c42c1733b6309332c1ed1
Author: Alynx Zhou <alynx zhou gmail com>
Date:   Thu Jan 9 10:12:41 2020 +0800

    keybindings: Move common window grab code out of X-only if statement
    
    `3c8d4171` moved some common codes into X11-only code blocks by mistake,
    and it prevents keyboard window resize/move mode under Wayland because
    those variables are unset. This commit fixed it via moving such common
    codes out of X11-only code blocks.
    
    Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/949
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/997

 src/core/keybindings.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 64f392f07..ab1ace5ae 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1820,12 +1820,12 @@ meta_window_grab_all_keys (MetaWindow  *window,
       meta_topic (META_DEBUG_KEYBINDINGS,
                   "Grabbing all keys on window %s\n", window->desc);
       retval = grab_keyboard (grabwindow, timestamp, XIGrabModeAsync);
-      if (retval)
-        {
-          window->keys_grabbed = FALSE;
-          window->all_keys_grabbed = TRUE;
-          window->grab_on_frame = window->frame != NULL;
-        }
+    }
+  if (retval)
+    {
+      window->keys_grabbed = FALSE;
+      window->all_keys_grabbed = TRUE;
+      window->grab_on_frame = window->frame != NULL;
     }
 
   return retval;
@@ -1835,9 +1835,10 @@ void
 meta_window_ungrab_all_keys (MetaWindow *window,
                              guint32     timestamp)
 {
-  if (!meta_is_wayland_compositor () && window->all_keys_grabbed)
+  if (window->all_keys_grabbed)
     {
-      ungrab_keyboard (timestamp);
+      if (!meta_is_wayland_compositor())
+        ungrab_keyboard (timestamp);
 
       window->grab_on_frame = FALSE;
       window->all_keys_grabbed = FALSE;


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