[mutter/wip/carlosg/x11less-preparations: 157/172] core: Avoid grab transfer shenanigans with non-X11 backend



commit 3c78a5ff74accd3ed40811a0d86084a447a8ef9f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 30 13:15:36 2018 +0100

    core: Avoid grab transfer shenanigans with non-X11 backend
    
    This explicit ungrab is made to ensure the other X11 display connection
    is able to start an active grab immediately on the device without receiving
    AlreadyGrabbed.
    
    This is just relevant if there's two X11 display connections to transfer
    grabs across, which may just happen on X11 windowing.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/420

 src/core/display.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 01bb7c085..9dc339da5 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1671,14 +1671,17 @@ meta_display_begin_grab_op (MetaDisplay *display,
   if (pointer_already_grabbed)
     display->grab_have_pointer = TRUE;
 
-  /* Since grab operations often happen as a result of implicit
-   * pointer operations on the display X11 connection, we need
-   * to ungrab here to ensure that the backend's X11 can take
-   * the device grab. */
-  XIUngrabDevice (display->x11_display->xdisplay,
-                  META_VIRTUAL_CORE_POINTER_ID,
-                  timestamp);
-  XSync (display->x11_display->xdisplay, False);
+  if (META_IS_BACKEND_X11 (meta_get_backend ()) && display->x11_display)
+    {
+      /* Since grab operations often happen as a result of implicit
+       * pointer operations on the display X11 connection, we need
+       * to ungrab here to ensure that the backend's X11 can take
+       * the device grab. */
+      XIUngrabDevice (display->x11_display->xdisplay,
+                      META_VIRTUAL_CORE_POINTER_ID,
+                      timestamp);
+      XSync (display->x11_display->xdisplay, False);
+    }
 
   if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
     display->grab_have_pointer = TRUE;


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