[Xfce4-commits] [xfce/xfwm4] 01/02: Revert "device: Use standard grabs for passive button grabs"

noreply at xfce.org noreply at xfce.org
Tue Apr 7 19:59:42 CEST 2020


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 0da6c4be6acc950ccdf0091376ed35204101031e
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Tue Apr 7 19:53:36 2020 +0200

    Revert "device: Use standard grabs for passive button grabs"
    
    Bug: 16649
    
    This reverts commit aa3e3cac7fb200f65f50bed32309c002775ed68a.
---
 src/device.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 45 insertions(+), 6 deletions(-)

diff --git a/src/device.c b/src/device.c
index 796be92..47403b1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -402,20 +402,59 @@ xfwm_device_grab_button (XfwmDevices *devices, Display *display,
                          gint grab_mode, gint paired_device_mode,
                          Window confine_to, Cursor cursor)
 {
-    gboolean status;
+    gboolean result;
+    Status status;
+#ifdef HAVE_XI2
+    XIGrabModifiers xi2_modifiers;
+    XIEventMask xievent_mask;
+#endif
 
-    status = XGrabButton (display, button, modifiers, grab_window,
-                          owner_events, event_mask, grab_mode, paired_device_mode,
-                          confine_to, cursor);
+#ifdef HAVE_XI2
+    if (devices->xi2_available)
+    {
+        xi2_modifiers.modifiers = xi2_modifier_mask (modifiers);
+        xi2_modifiers.status = 0;
 
-    return status;
+        xfwm_device_fill_xi2_event_mask (&xievent_mask, event_mask);
+        status = XIGrabButton (display, devices->pointer.xi2_device, button, grab_window,
+                               cursor, grab_mode, paired_device_mode, owner_events,
+                               &xievent_mask, 1, &xi2_modifiers);
+        g_free (xievent_mask.mask);
+        result = (status == XIGrabSuccess);
+    }
+    else
+#endif
+    {
+        status = XGrabButton (display, button, modifiers, grab_window,
+                              owner_events, event_mask, grab_mode, paired_device_mode,
+                              confine_to, cursor);
+        result = (status == GrabSuccess);
+    }
+    return result;
 }
 
 void
 xfwm_device_ungrab_button (XfwmDevices *devices, Display *display,
                            guint button, guint modifiers, Window grab_window)
 {
-    XUngrabButton (display, button, modifiers, grab_window);
+#ifdef HAVE_XI2
+    XIGrabModifiers xi2_modifiers;
+#endif
+
+#ifdef HAVE_XI2
+    if (devices->xi2_available)
+    {
+        xi2_modifiers.modifiers = xi2_modifier_mask (modifiers);
+        xi2_modifiers.status = 0;
+
+        XIUngrabButton (display, devices->pointer.xi2_device, button,
+                        grab_window, 1, &xi2_modifiers);
+    }
+    else
+#endif
+    {
+        XUngrabButton (display, button, modifiers, grab_window);
+    }
 }
 
 gboolean

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list