summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-04-18 18:21:54 -0700
committerChase Douglas <chase.douglas@ubuntu.com>2012-04-18 20:36:02 -0700
commit00cf1c40b28417d7035c2917d048553eb720023c (patch)
tree45e3f3ce6bb3c66351bab7d04c49f5b13ca96167
parent312910b4e34215aaa50fc0c6092684d5878dc32f (diff)
Replay original touch begin event instead of generated begin eventinput-fixes
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>
-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());