From 6ca30cb33e829b4edd01822367e44ffe6f0951b0 Mon Sep 17 00:00:00 2001 From: Chase Douglas Date: Wed, 11 Apr 2012 08:17:25 -0700 Subject: [PATCH] When deactivating an explicit pointer grab, reject all grabs on touches Explicit pointer grabs are placed at the head of the touch listener array for pointer emulated touches. If the grab is deactivated, we must remove it from all touches for the device. Signed-off-by: Chase Douglas Reviewed-by: Peter Hutterer --- dix/events.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dix/events.c b/dix/events.c index a137d6f7a..52ce0b875 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1473,6 +1473,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse) DeviceIntPtr dev; Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && mouse->deviceGrab.implicitGrab); + XID grab_resource = grab->resource; + int i; TouchRemovePointerGrab(mouse); @@ -1497,6 +1499,15 @@ DeactivatePointerGrab(DeviceIntPtr mouse) ReattachToOldMaster(mouse); ComputeFreezes(); + + /* If an explicit grab was deactivated, we must remove it from the head of + * all the touches' listener lists. */ + for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) { + TouchPointInfoPtr ti = mouse->touch->touches + i; + + if (ti->active && TouchResourceIsOwner(ti, grab_resource)) + TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); + } } /**