diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-08-07 11:04:46 +1000 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-08-20 16:11:07 -0700 |
commit | 839c0b3d4abe5c5fc4840b9b916ad1e55d58359e (patch) | |
tree | 48757d656a6e9542e3000b94fa53cd715dd559fd | |
parent | 765eee9cdf96beff066d7215f464ff869d996c8f (diff) | |
download | weston-839c0b3d4abe5c5fc4840b9b916ad1e55d58359e.tar.gz weston-839c0b3d4abe5c5fc4840b9b916ad1e55d58359e.tar.bz2 weston-839c0b3d4abe5c5fc4840b9b916ad1e55d58359e.zip |
evdev: get the current slot value from the absinfo struct or mtdev
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.
-rw-r--r-- | src/evdev.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/evdev.c b/src/evdev.c index 76463192..999ab8e6 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -469,7 +469,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)) { @@ -479,6 +478,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; } } } |