[PATCH 3/4] dix: when deactivating pointer-only grabs, don't emulate TouchEnd events

Peter Hutterer peter.hutterer at who-t.net
Sun Nov 25 22:12:34 PST 2012


A client with a pointer grab on a touch device must reject the touch when
detactivating the grab while the touch is active. However, such a rejecting
must not trigger a ButtonRelease event to be emulated and sent to the
client.
Set the grabbing listener's state to HAS_END, so we simply skip delivery to
that client.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Intentionally kept separate from 2/4 to make the reasoning for this more
obvious in the history.

 dix/events.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dix/events.c b/dix/events.c
index 377498c..e542b1f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1513,8 +1513,15 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
      * all the touches' listener lists. */
     for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) {
         TouchPointInfoPtr ti = mouse->touch->touches + i;
-        if (ti->active && TouchResourceIsOwner(ti, grab_resource))
+        if (ti->active && TouchResourceIsOwner(ti, grab_resource)) {
+            /* Rejecting will generate a TouchEnd, but we must not
+               emulate a ButtonRelease here. So pretend the listener
+               already has the end event */
+            if (grab->grabtype == CORE || grab->grabtype == XI ||
+                    !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin))
+                ti->listeners[0].state = LISTENER_HAS_END;
             TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
+        }
     }
 
     TouchRemovePointerGrab(mouse);
-- 
1.7.11.7



More information about the xorg-devel mailing list