[PATCH libinput 2/9] evdev: Avoid double touch down/up events
Jonas Ådahl
jadahl at gmail.com
Wed Apr 9 12:02:09 PDT 2014
When the kernel sends multiple touch down or touch up for the same slot
in a row, ignore any such subsequent event ensuring libinput always
produces 1 x touch down -> [n x touch motion] -> 1 x touch up event
series.
Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
src/evdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/evdev.c b/src/evdev.c
index cc0c4bf..b6aaf57 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -132,6 +132,9 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ if (device->mt.slots[slot].seat_slot != -1)
+ break;
+
seat_slot = ffs(~seat->slot_map) - 1;
device->mt.slots[slot].seat_slot = seat_slot;
@@ -162,6 +165,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
break;
seat_slot = device->mt.slots[slot].seat_slot;
+ device->mt.slots[slot].seat_slot = -1;
if (seat_slot == -1)
break;
@@ -174,6 +178,9 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ if (device->abs.seat_slot != -1)
+ break;
+
seat_slot = ffs(~seat->slot_map) - 1;
device->abs.seat_slot = seat_slot;
@@ -209,6 +216,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
break;
seat_slot = device->abs.seat_slot;
+ device->abs.seat_slot = -1;
if (seat_slot == -1)
break;
@@ -713,6 +721,7 @@ evdev_device_create(struct libinput_seat *seat,
libinput_seat_ref(seat);
+ device->abs.seat_slot = -1;
device->mt.slot = -1;
device->mt.slots = NULL;
device->mt.slots_len = 0;
--
1.8.3.2
More information about the wayland-devel
mailing list