Commit 00cf1c40 authored by Chase Douglas's avatar Chase Douglas Committed by Chase Douglas

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: default avatarChase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 312910b4
......@@ -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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment