[PATCH 2/2] dix: Use XINotifyPassiveGrab/Ungrab on button passive grab crossings

carlosg at gnome.org carlosg at gnome.org
Mon Nov 25 09:14:38 PST 2013


From: Carlos Garnacho <carlosg at gnome.org>

XI2 clients were getting crossing events with XINotifyGrab/Ungrab modes
whenever a passive button grab was triggered, even though XI2 provides
XINotifyPassiveGrab/Ungrab for these situations. Fix this by setting
the right XI2 mode when that happens, DoEnterLeaveEvents will conveniently
transform it to the right mode for Core events when those are emitted.

https://bugs.freedesktop.org/show_bug.cgi?id=71762

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 dix/events.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 9260b45..6c83504 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1530,7 +1530,8 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
                 mouse->spriteInfo->sprite->hotPhys.y = 0;
         ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
     }
-    DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab,
+    DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window,
+                       isPassive ? XINotifyPassiveGrab : XINotifyGrab,
                        EVENT_CORE_MASK | EVENT_XI2_MASK);
     mouse->valuator->motionHintWindow = NullWindow;
     if (syncEvents.playingEvents)
@@ -1598,7 +1599,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
             dev->deviceGrab.sync.other = NullGrab;
     }
     DoEnterLeaveEvents(mouse, mouse->id, grab->window,
-                       mouse->spriteInfo->sprite->win, NotifyUngrab,
+                       mouse->spriteInfo->sprite->win,
+                       wasPassive ? XINotifyPassiveUngrab : XINotifyUngrab,
                        EVENT_CORE_MASK | EVENT_XI2_MASK);
     if (grab->confineTo)
         ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
-- 
1.8.4.2



More information about the xorg-devel mailing list