summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-05-14 14:51:31 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-07-17 14:37:34 +1000
commitc0be1168fd3dd2eb01187789ddc30d7aab909a98 (patch)
tree5933cb63d4e3e8513938e37dc6fabda04babf32f
parent5c32bd0e2c104deaa2820c62289916fff6a4e3cd (diff)
dix: call UpdateDeviceState() for emulated TouchEndEvents
ProcessTouchEvents() calls UDS for all touch events, but if the event type was switched to TouchUpdate(pending end) UDS is a noop. Daniel Drake found this can cause stuck buttons if a touch grab is activated, rejected and the touch event is passed to a regular listener. This sequence causes the TouchEnd to be changed to TouchUpdate(pending end). The actual TouchEnd event is later generated by the server once it is passed to the next listener. UDS is never called for this event, thus the button remains logically down. A previous patch suggested for UDS to handle TouchUpdate events [1], however this would release the button when the first TouchEvent is processed, not when the last grab has been released (as is the case for sync pointer grabs). A client may thus have the grab on the device, receive a ButtonPress but see the button logically up in an XQueryPointer request. This patch adds a call to UDS to TouchEmitTouchEnd(). The device state must be updated once a TouchEnd event was sent to the last grabbing listener and the number of grabs on the touchpoint is 0. [1] http://patchwork.freedesktop.org/patch/13464/ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 35c2e263db01b2b61354298e5e85aa3cae8ac317)
-rw-r--r--dix/touch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dix/touch.c b/dix/touch.c
index 110b1cce2..a4b6d7eea 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -1122,6 +1122,8 @@ TouchEmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resourc
TouchDeliverDeviceClassesChangedEvent(ti, GetTimeInMillis(), resource);
GetDixTouchEnd(&event, dev, ti, flags);
DeliverTouchEvents(dev, ti, &event, resource);
+ if (ti->num_grabs == 0)
+ UpdateDeviceState(dev, &event.device_event);
}
void