summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-12-14 16:26:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-21 12:38:35 +1000
commit6a68f97ce6704dd2ff2a50f91acd2da72c9995bd (patch)
tree7fd05ae10d084aef219bd01012823a59c84b7241 /dix
parent8e58ce73c8b79cb86e890369d0216cdd850c52a5 (diff)
dix: add TouchGetPointerEventType helper function
Returns the respective pointer event type for a given touch event type. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/touch.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/dix/touch.c b/dix/touch.c
index 0f2c0c335..2647ca4be 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -593,3 +593,24 @@ TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
return TRUE;
}
+
+/**
+ * Return the corresponding pointer emulation internal event type for the given
+ * touch event or 0 if no such event type exists.
+ */
+int
+TouchGetPointerEventType(const InternalEvent *event)
+{
+ int type = 0;
+
+ switch(event->any.type)
+ {
+ case ET_TouchBegin: type = ET_ButtonPress; break;
+ case ET_TouchUpdate: type = ET_Motion; break;
+ case ET_TouchEnd: type = ET_ButtonRelease; break;
+ default:
+ break;
+ }
+ return type;
+}
+