summaryrefslogtreecommitdiff
path: root/dix/getevents.c
diff options
context:
space:
mode:
authorThomas Jaeger <ThJaeger@gmail.com>2012-10-13 23:08:27 -0400
committerPeter Hutterer <peter.hutterer@who-t.net>2012-11-20 15:42:46 +1000
commitfe59774c55e5d423633405e0869c22f4ce382548 (patch)
tree994477165bcf86166a42b0ba377e0ff4d9c0ff9d /dix/getevents.c
parentcc79107a5b60d2926e16ddbee04149e8d5acc969 (diff)
Don't use GetTouchEvents in EmitTouchEnd
As before GetTouchEvents causes unwanted side effects. Add a new function GetDixTouchEnd, which generates a touch event from the touch point. We fill in the event's screen coordinates from the MD's current sprite position. Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/getevents.c')
-rw-r--r--dix/getevents.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 5c1e97ef4..39b0821f6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -2022,6 +2022,37 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
return num_events;
}
+void
+GetDixTouchEnd(InternalEvent *ievent, DeviceIntPtr dev, TouchPointInfoPtr ti,
+ uint32_t flags)
+{
+ ScreenPtr scr = dev->spriteInfo->sprite->hotPhys.pScreen;
+ DeviceEvent *event = &ievent->device_event;
+ CARD32 ms = GetTimeInMillis();
+
+ BUG_WARN(!dev->enabled);
+
+ init_device_event(event, dev, ms);
+
+ event->sourceid = ti->sourceid;
+ event->type = ET_TouchEnd;
+
+ event->root = scr->root->drawable.id;
+
+ /* Get screen event coordinates from the sprite. Is this really the best
+ * we can do? */
+ event_set_root_coordinates(event,
+ dev->last.valuators[0],
+ dev->last.valuators[1]);
+ event->touchid = ti->client_id;
+ event->flags = flags;
+
+ if (flags & TOUCH_POINTER_EMULATED) {
+ event->flags |= TOUCH_POINTER_EMULATED;
+ event->detail.button = 1;
+ }
+}
+
/**
* Synthesize a single motion event for the core pointer.
*