Commit cc79107a authored by Thomas Jaeger's avatar Thomas Jaeger Committed by Peter Hutterer

Don't use GetTouchEvents when replaying events

GetTouchEvents has plenty of side effects such as moving the pointer or
updating the master device, which we don't want to happen when
replaying.  The only reason for calling it was to generate a DCCE event,
but GetTouchEvents doesn't even do that right (we might need a DCCE
event even when replaying a master event, or clients could interpret
valuator data incorrectly).

This discussion is moot at the moment anyway, since DeliverTouchEvents
doesn't appear to deliver DCCE events.
Signed-off-by: default avatarThomas Jaeger <>
Reviewed-by: default avatarPeter Hutterer <>

[Added call to processInputProc instead of direct call to DeliverTouchEvents]
Signed-off-by: default avatarPeter Hutterer <>
parent 90b177e5
......@@ -463,45 +463,14 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev)
TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
InternalEvent *tel;
ValuatorMask *mask;
int i, nev;
int flags;
int i;
if (!ti->history)
tel = InitEventList(GetMaximumEventsNum());
mask = valuator_mask_new(0);
valuator_mask_set_double(mask, 0, ti->history[0][0]);
valuator_mask_set_double(mask, 1, ti->history[0][1]);
if (ti->emulate_pointer)
/* 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++) {
/* 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);
FreeEventList(tel, GetMaximumEventsNum());
TouchDeliverDeviceClassesChangedEvent(ti, ti->history[0].time, resource);
/* First event was TouchBegin, already replayed that one */
for (i = 1; i < ti->history_elements; i++) {
for (i = 0; i < ti->history_elements; i++) {
DeviceEvent *ev = &ti->history[i];
ev->flags |= TOUCH_REPLAYING;
......@@ -509,6 +478,30 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti, Time time,
XID resource)
DeviceIntPtr dev;
int num_events = 0;
InternalEvent dcce;
dixLookupDevice(&dev, ti->sourceid, serverClient, DixWriteAccess);
if (!dev)
/* UpdateFromMaster generates at most one event */
UpdateFromMaster(&dcce, dev, DEVCHANGE_POINTER_EVENT, &num_events);
BUG_WARN(num_events > 1);
if (num_events) {
dcce.any.time = time;
/* FIXME: This doesn't do anything */
dev->public.processInputProc(&dcce, dev);
TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
......@@ -580,6 +580,8 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti,
extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
uint32_t touchid, Window grab_window, XID *error);
extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
extern void TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti,
Time time, XID resource);
/* misc event helpers */
extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients);
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