summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-06-07 14:12:06 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2012-11-07 09:58:38 +1000
commit9ddc6ad9d02d886c1dba0496fc9480db64529bf2 (patch)
tree05ad755dbb1a1c8ae1dfbb55108c6f372c5cf7e7 /dix
parent36f9c2d1ddc8a35c0317db55044d05f07284ab38 (diff)
End physically active touches when device is disabled
Otherwise: * We can't end the touches while device is disabled * New touches after enabling the device may erroneously be mapped to old logical touches Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 3b67cd26149eb991b5f015061a818af65369e668)
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c1
-rw-r--r--dix/touch.c28
2 files changed, 29 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 66d440683..fd4916a3a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -443,6 +443,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
if (*prev != dev)
return FALSE;
+ TouchEndPhysicallyActiveTouches(dev);
ReleaseButtonsAndKeys(dev);
SyncRemoveDeviceIdleTime(dev->idle_counter);
dev->idle_counter = NULL;
diff --git a/dix/touch.c b/dix/touch.c
index 497ad7dac..e64a6262c 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -1029,3 +1029,31 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
return TouchListenerAcceptReject(dev, ti, i, mode);
}
+
+/**
+ * End physically active touches for a device.
+ */
+void
+TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
+{
+ InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+ int i;
+
+ OsBlockSignals();
+ mieqProcessInputEvents();
+ for (i = 0; i < dev->last.num_touches; i++) {
+ DDXTouchPointInfoPtr ddxti = dev->last.touches + i;
+
+ if (ddxti->active) {
+ int j;
+ int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id,
+ XI_TouchEnd, 0, NULL);
+
+ for (j = 0; j < nevents; j++)
+ mieqProcessDeviceEvent(dev, eventlist + j, NULL);
+ }
+ }
+ OsReleaseSignals();
+
+ FreeEventList(eventlist, GetMaximumEventsNum());
+}