From ece8157a59751b3ed492fb2e1eb8d5f20221e195 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 26 Nov 2012 15:14:19 +1000 Subject: [PATCH] dix: when deactivating pointer-only grabs, don't emulate TouchEnd events 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 --- dix/events.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dix/events.c b/dix/events.c index 03ed106ed..31f8d8700 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);