mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-06 19:40:29 +01:00
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.
This commit is contained in:
parent
fe57a4e5fa
commit
3fe16ee03b
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue