[PATCH weston 07/10] evdev: get the current slot value from the absinfo struct or mtdev
Peter Hutterer
peter.hutterer at who-t.net
Tue Aug 6 18:04:46 PDT 2013
If touches are already present on the device, absinfo has the currently
active touch slot. There's a race condition where the slot may change before
we enable the fd and we thus miss out on the ABS_MT_SLOT event. It's still
slightly more correct than assuming whatever comes next is slot 0.
---
src/evdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/evdev.c b/src/evdev.c
index 319c9c1..7462e83 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -466,7 +466,6 @@ evdev_handle_device(struct evdev_device *device)
device->abs.min_y = absinfo.minimum;
device->abs.max_y = absinfo.maximum;
device->is_mt = 1;
- device->mt.slot = 0;
device->caps |= EVDEV_TOUCH;
if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
@@ -476,6 +475,11 @@ evdev_handle_device(struct evdev_device *device)
device->devnode);
return 0;
}
+ device->mt.slot = device->mtdev->caps.slot.value;
+ } else {
+ ioctl(device->fd, EVIOCGABS(ABS_MT_SLOT),
+ &absinfo);
+ device->mt.slot = absinfo.value;
}
}
}
--
1.8.2.1
More information about the wayland-devel
mailing list