[PATCH libinput 2/8] evdev: Avoid double touch down/up events

Peter Hutterer peter.hutterer at who-t.net
Wed Mar 26 01:00:11 PDT 2014


On Wed, Mar 26, 2014 at 08:40:43AM +0100, Jonas Ådahl wrote:
> On Wed, Mar 26, 2014 at 05:30:14PM +1000, Peter Hutterer wrote:
> > On Wed, Mar 26, 2014 at 07:45:32AM +0100, Michael Schellenberger Costa wrote:
> > > I might be dumb but doesnt this require motion between clicks?
> > > 
> > > In that case you would lose for example track balls which do not
> > > necessary move between clicks.
> > 
> > this is for touch events only here, and the only way you can get here is if
> > you have a SYN_DROPPED event and you're losing one of the
> > ABS_MT_TRACKING_ID. This is fixed with libevdev 1.1, but better be safe than
> > sorry here.
> 
> We can also get this if we have an libevdev managed uinput device with
> mt slot limit x while sending mt slot x + n events. libevdev will
> sanitize the events making any mt slot x + n event a mt slot x event.

huh, right, I didn't think of that. I'll see if I can fix this in libevdev.

Cheers,
   Peter

> > 
> > > On 25.03.2014 21:45, Jonas Ådahl wrote:
> > > > 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 | 13
> > > > +++++++++++++ 1 file changed, 13 insertions(+)
> > > > 
> > > > diff --git a/src/evdev.c b/src/evdev.c index ff8b27a..729e1f4
> > > > 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -135,6 +135,9 @@
> > > > evdev_flush_pending_event(struct evdev_device *device, uint32_t
> > > > time) if (slot >= MAX_SLOTS) 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;
> > > > 
> > > > @@ -171,6 +174,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; @@ -183,6 +187,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;
> > > > 
> > > > @@ -218,6 +225,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; @@ -655,6 +663,7 @@
> > > > evdev_device_create(struct libinput_seat *seat, int rc; int fd; int
> > > > unhandled_device = 0; +	int i;
> > > > 
> > > > /* Use non-blocking mode so that we can loop on read on *
> > > > evdev_device_data() until all events on the fd are @@ -712,6
> > > > +721,10 @@ evdev_device_create(struct libinput_seat *seat, if
> > > > (!device->source) goto err;
> > > > 
> > > > +	device->abs.seat_slot = -1; +	for (i = 0; i < MAX_SLOTS; ++i) +
> > > > device->mt.slots[i].seat_slot = -1; + 
> > > > list_insert(seat->devices_list.prev, &device->base.link); 
> > > > notify_added_device(&device->base);
> > > > 
> > > > 
> > > 
> > > _______________________________________________
> > > wayland-devel mailing list
> > > wayland-devel at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> > > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list