Xi: ungrab device when releasing a passive grab without ButtonReleaseMask (#71878)

Submitted by Peter Hutterer on Dec. 2, 2013, 11:02 p.m.

Details

Message ID 20131202230259.GA9767@yabbi.redhat.com
State Accepted
Commit 23394c7fea0f5c33333198c87ecfecc9f6c6a791
Headers show

Not browsing as part of any series.

Commit Message

Peter Hutterer Dec. 2, 2013, 11:02 p.m.
If a touch triggers an async button grab and that grab does not have the
ButtonReleaseMask set, the TouchEnd is never delivered, deliveries is 0  and
the grab is never deactivated.

If the grab is pointer async and keyboard sync, the keyboard events are stuck
in EnqueueEvent until some other pointer event terminates the grab.

Change this to check for the number of listeners. If we're about to deliver a
TouchEnd to a passive pointer grab, the number of listeners is already 1 -
pointer grabs always accept so other listeners were removed.

X.Org Bug 71878 <http://bugs.freedesktop.org/show_bug.cgi?id=71878>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 Xi/exevents.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 5e1d3e0..dff0a92 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1413,7 +1413,8 @@  DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
                 !(ev->device_event.flags & TOUCH_CLIENT_ID))
                 TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
 
-            if (deliveries && ev->any.type == ET_TouchEnd &&
+            if (ev->any.type == ET_TouchEnd &&
+                ti->num_listeners == 1 &&
                 !dev->button->buttonsDown &&
                 dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab)) {
                 (*dev->deviceGrab.DeactivateGrab) (dev);