mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 14:40:26 +01:00
evdev: any scroll device must have CAP_POINTER
Follow-up to e2f61b8fb7.
Scroll events are sent through the pointer interface, so we must set the
capability. Otherwise a caller may not have the required bits set up and is a
bit surprised by events coming out of an interface the device doesn't actually
have (xf86-input-libinput crashes when this happens).
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
ae1ede741d
commit
e15a7a740d
2 changed files with 16 additions and 1 deletions
|
|
@ -1700,8 +1700,10 @@ evdev_configure_device(struct evdev_device *device)
|
|||
|
||||
/* want natural-scroll config option */
|
||||
if (libevdev_has_event_code(evdev, EV_REL, REL_WHEEL) ||
|
||||
libevdev_has_event_code(evdev, EV_REL, REL_HWHEEL))
|
||||
libevdev_has_event_code(evdev, EV_REL, REL_HWHEEL)) {
|
||||
device->scroll.natural_scrolling_enabled = true;
|
||||
device->seat_caps |= EVDEV_DEVICE_POINTER;
|
||||
}
|
||||
}
|
||||
|
||||
if (udev_tags & EVDEV_UDEV_TAG_TOUCHSCREEN) {
|
||||
|
|
|
|||
|
|
@ -979,6 +979,17 @@ START_TEST(abs_mt_device_missing_res)
|
|||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(device_wheel_only)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
ck_assert(libinput_device_has_capability(device,
|
||||
LIBINPUT_DEVICE_CAP_POINTER));
|
||||
}
|
||||
END_TEST
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
litest_add("device:sendevents", device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD);
|
||||
|
|
@ -1016,5 +1027,7 @@ int main (int argc, char **argv)
|
|||
litest_add_no_device("device:invalid devices", abs_device_missing_res);
|
||||
litest_add_no_device("device:invalid devices", abs_mt_device_missing_res);
|
||||
|
||||
litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE);
|
||||
|
||||
return litest_run(argc, argv);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue