diff options
author | Thomas Jaeger <ThJaeger@gmail.com> | 2012-10-13 22:51:24 -0400 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-11-20 15:42:01 +1000 |
commit | cc79107a5b60d2926e16ddbee04149e8d5acc969 (patch) | |
tree | 996e58560df662f8b289553ba8734431bfbff3e2 /dix/touch.c | |
parent | 90b177e5cbb9047453af426d2abfe9c0514fe866 (diff) |
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: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
[Added call to processInputProc instead of direct call to DeliverTouchEvents]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/touch.c')
-rw-r--r-- | dix/touch.c | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/dix/touch.c b/dix/touch.c index 5f77be575..29ba17194 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -463,45 +463,14 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev) void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource) { - InternalEvent *tel; - ValuatorMask *mask; - int i, nev; - int flags; + int i; if (!ti->history) return; - tel = InitEventList(GetMaximumEventsNum()); - mask = valuator_mask_new(0); - - valuator_mask_set_double(mask, 0, ti->history[0].valuators.data[0]); - valuator_mask_set_double(mask, 1, ti->history[0].valuators.data[1]); - - flags = TOUCH_CLIENT_ID | TOUCH_REPLAYING; - if (ti->emulate_pointer) - flags |= TOUCH_POINTER_EMULATED; - /* 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); - } - } - - valuator_mask_free(&mask); - 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) } } +void +TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti, Time time, + XID resource) +{ + DeviceIntPtr dev; + int num_events = 0; + InternalEvent dcce; + + dixLookupDevice(&dev, ti->sourceid, serverClient, DixWriteAccess); + + if (!dev) + return; + + /* 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); + } +} + Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite) { |