[PATCH 2/2] End physically active touches when device is disabled
Chase Douglas
chase.douglas at canonical.com
Tue May 15 13:21:55 PDT 2012
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 at canonical.com>
---
dix/devices.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dix/devices.c b/dix/devices.c
index 7f38865..8a60cfd 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -415,6 +415,31 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
/**
+ * End physically active touches for a device.
+ */
+static void
+EndPhysicallyActiveTouches(DeviceIntPtr dev)
+{
+ InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+ int i;
+
+ 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);
+ }
+ }
+
+ FreeEventList(eventlist, GetMaximumEventsNum());
+}
+
+/**
* Switch a device off through the driver and push it onto the off_devices
* list. A device will not send events while disabled. All clients are
* notified about the device being disabled.
@@ -437,6 +462,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
if (*prev != dev)
return FALSE;
+ EndPhysicallyActiveTouches(dev);
ReleaseButtonsAndKeys(dev);
SyncRemoveDeviceIdleTime(dev->idle_counter);
dev->idle_counter = NULL;
--
1.7.9.5
More information about the xorg-devel
mailing list