summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-11-26 14:55:13 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-01-21 13:49:55 +1000
commit956700d14d01a6d8a1bb8b8f9b910ef044ad154b (patch)
treead32043ba780cd883a0e352357013d9514faa3be /Xi
parent39157fd2405ad855d0f60578b57e193a744bb075 (diff)
Xi: if a TouchEnd appears on a actively grabbing client, always accept
Once the TouchEnd appears on the device, the touch is done. If the client still has a pointer grab, accept it to avoid clients with TouchOwnership selections to wait indefinitely for the actual touch event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 00def5144557cfe8bf535f926212a8e084dc7cf6) Conflicts: Xi/exevents.c
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 106da3a1b..b691d2094 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1576,32 +1576,41 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
else
ti = TouchFindByClientID(dev, touchid);
- /* Under the following circumstances we create a new touch record for an
- * existing touch:
- *
- * - The touch may be pointer emulated
- * - An explicit grab is active on the device
- * - The grab is a pointer grab
- *
- * This allows for an explicit grab to receive pointer events for an already
- * active touch.
- */
- if (!ti && type != ET_TouchBegin && emulate_pointer &&
- dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab &&
+ /* Active pointer grab */
+ if (emulate_pointer && dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab &&
(dev->deviceGrab.grab->grabtype == CORE ||
dev->deviceGrab.grab->grabtype == XI ||
- !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin))) {
- ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
- emulate_pointer);
- if (!ti) {
- DebugF("[Xi] %s: Failed to create new dix record for explicitly "
- "grabbed touchpoint %d\n",
- dev->name, type, touchid);
- return;
- }
+ !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin)))
+ {
+ /* Active pointer grab on touch point and we get a TouchEnd - claim this
+ * touchpoint accepted, otherwise clients waiting for ownership will
+ * wait on this touchpoint until this client ungrabs, or the cows come
+ * home, whichever is earlier */
+ if (ti && type == ET_TouchEnd)
+ TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
+ else if (!ti && type != ET_TouchBegin) {
+ /* Under the following circumstances we create a new touch record for an
+ * existing touch:
+ *
+ * - The touch may be pointer emulated
+ * - An explicit grab is active on the device
+ * - The grab is a pointer grab
+ *
+ * This allows for an explicit grab to receive pointer events for an already
+ * active touch.
+ */
+ ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
+ emulate_pointer);
+ if (!ti) {
+ DebugF("[Xi] %s: Failed to create new dix record for explicitly "
+ "grabbed touchpoint %d\n",
+ dev->name, touchid);
+ return;
+ }
- TouchBuildSprite(dev, ti, ev);
- TouchSetupListeners(dev, ti, ev);
+ TouchBuildSprite(dev, ti, ev);
+ TouchSetupListeners(dev, ti, ev);
+ }
}
if (!ti) {