summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-04-18 18:21:54 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2012-04-26 13:35:24 +1000
commit9ef48c9ffff6704dbe7c976d86527f22b0e1d114 (patch)
tree60cfda1c1f042380ec4ba603d353bc1fc3ad26eb
parent73cd880fe05c941391a8604406e9ecf657a77f02 (diff)
Replay original touch begin event instead of generated begin event
The generated event does not have axes other than X and Y and has a newer timestamp. In particular, the newer timestamp may be newer than the real touch end event, which may be stuck in the syncEvents queue. If a client uses the timestamps for grabbing bad things may happen. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 00cf1c40b28417d7035c2917d048553eb720023c)
-rw-r--r--dix/touch.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/dix/touch.c b/dix/touch.c
index 67c4be26d..dd16367d0 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -474,10 +474,22 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
flags = TOUCH_CLIENT_ID | TOUCH_REPLAYING;
if (ti->emulate_pointer)
flags |= TOUCH_POINTER_EMULATED;
- /* send fake begin event to next owner */
+ /* Generate events based on a fake touch begin event to get DCCE events if
+ * needed */
+ /* FIXME: This needs to be cleaned up */
nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchBegin, flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(dev, ti, tel + i, resource);
+ for (i = 0; i < nev; i++) {
+ /* Send saved touch begin event */
+ if (tel[i].any.type == ET_TouchBegin) {
+ DeviceEvent *ev = &ti->history[0];
+ ev->flags |= TOUCH_REPLAYING;
+ DeliverTouchEvents(dev, ti, (InternalEvent*)ev, resource);
+ }
+ else {/* Send DCCE event */
+ tel[i].any.time = ti->history[0].time;
+ DeliverTouchEvents(dev, ti, tel + i, resource);
+ }
+ }
valuator_mask_free(&mask);
FreeEventList(tel, GetMaximumEventsNum());