[Xfce4-commits] [xfce/xfwm4] 02/02: device: Check standard passive button grabs
noreply at xfce.org
noreply at xfce.org
Tue Apr 7 19:59:43 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 0c376d254293ca52162bcddf4bcfa5908fb28e4c
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Tue Apr 7 19:53:58 2020 +0200
device: Check standard passive button grabs
Bug: 16649
With Xi2 we need to use Xi2 routines.
But some client may issue standard X11 core protocol grabs the on the
client window.
Grabs from the standard core protocol and Xi2 grabs do not mix well.
So instead of ditching the Xi2 grabs, we issue the core protocol first,
check that it succeeds and only if that works we can issue the Xi2
grabs.
That keeps the Xi2 grabs logic while fixing the issue with X-AIR-Edit
which uses a passive grab on the pointer using core X11 protocol.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
src/device.c | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/device.c b/src/device.c
index 47403b1..26eaccc 100644
--- a/src/device.c
+++ b/src/device.c
@@ -27,6 +27,8 @@
#include <X11/extensions/XInput2.h>
#endif
+#include "display.h"
+
#ifdef HAVE_XI2
static const struct
{
@@ -404,11 +406,22 @@ xfwm_device_grab_button (XfwmDevices *devices, Display *display,
{
gboolean result;
Status status;
+ DisplayInfo *display_info;
#ifdef HAVE_XI2
XIGrabModifiers xi2_modifiers;
XIEventMask xievent_mask;
#endif
+ display_info = myDisplayGetDefault ();
+ myDisplayErrorTrapPush (display_info);
+ result = XGrabButton (display, button, modifiers, grab_window,
+ owner_events, event_mask, grab_mode, paired_device_mode,
+ confine_to, cursor);
+ if (myDisplayErrorTrapPop (display_info) || !result)
+ {
+ return FALSE;
+ }
+
#ifdef HAVE_XI2
if (devices->xi2_available)
{
@@ -422,14 +435,8 @@ xfwm_device_grab_button (XfwmDevices *devices, Display *display,
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;
}
@@ -441,6 +448,7 @@ xfwm_device_ungrab_button (XfwmDevices *devices, Display *display,
XIGrabModifiers xi2_modifiers;
#endif
+ XUngrabButton (display, button, modifiers, grab_window);
#ifdef HAVE_XI2
if (devices->xi2_available)
{
@@ -450,11 +458,7 @@ xfwm_device_ungrab_button (XfwmDevices *devices, Display *display,
XIUngrabButton (display, devices->pointer.xi2_device, button,
grab_window, 1, &xi2_modifiers);
}
- else
#endif
- {
- XUngrabButton (display, button, modifiers, grab_window);
- }
}
gboolean
@@ -465,11 +469,21 @@ xfwm_device_grab_keycode (XfwmDevices *devices, Display *display,
{
gboolean result;
Status status;
+ DisplayInfo *display_info;
#ifdef HAVE_XI2
XIGrabModifiers xi2_modifiers;
XIEventMask xievent_mask;
#endif
+ display_info = myDisplayGetDefault ();
+ myDisplayErrorTrapPush (display_info);
+ result = XGrabKey (display, keycode, modifiers, grab_window,
+ owner_events, grab_mode, paired_device_mode);
+ if (myDisplayErrorTrapPop (display_info) || !result)
+ {
+ return FALSE;
+ }
+
#ifdef HAVE_XI2
if (devices->xi2_available)
{
@@ -485,11 +499,7 @@ xfwm_device_grab_keycode (XfwmDevices *devices, Display *display,
}
else
#endif
- {
- status = XGrabKey (display, keycode, modifiers, grab_window,
- owner_events, grab_mode, paired_device_mode);
- result = (status == GrabSuccess);
- }
+
return result;
}
@@ -501,6 +511,8 @@ xfwm_device_ungrab_keycode (XfwmDevices *devices, Display *display,
XIGrabModifiers xi2_modifiers;
#endif
+ XUngrabKey (display, keycode, modifiers, grab_window);
+
#ifdef HAVE_XI2
if (devices->xi2_available)
{
@@ -510,11 +522,7 @@ xfwm_device_ungrab_keycode (XfwmDevices *devices, Display *display,
XIUngrabKeycode (display, devices->keyboard.xi2_device, keycode,
grab_window, 1, &xi2_modifiers);
}
- else
#endif
- {
- XUngrabKey (display, keycode, modifiers, grab_window);
- }
}
#ifdef HAVE_XI2
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list