diff --git a/src/evdev.c b/src/evdev.c index 2d18bed9..7fd8478f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1536,10 +1536,19 @@ static uint32_t evdev_scroll_get_default_button(struct libinput_device *device) { struct evdev_device *evdev = evdev_device(device); + unsigned int code; if (libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE)) return BTN_MIDDLE; + for (code = BTN_SIDE; code <= BTN_TASK; code++) { + if (libevdev_has_event_code(evdev->evdev, EV_KEY, code)) + return code; + } + + if (libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_RIGHT)) + return BTN_RIGHT; + return 0; } diff --git a/test/test-pointer.c b/test/test-pointer.c index 06c45b2c..e09f8f8a 100644 --- a/test/test-pointer.c +++ b/test/test-pointer.c @@ -1176,11 +1176,15 @@ START_TEST(pointer_scroll_defaults_logitech_marble) struct litest_device *dev = litest_current_device(); struct libinput_device *device = dev->libinput_device; enum libinput_config_scroll_method method; + uint32_t button; method = libinput_device_config_scroll_get_method(device); ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); method = libinput_device_config_scroll_get_default_method(device); ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); + + button = libinput_device_config_scroll_get_button(device); + ck_assert_int_eq(button, BTN_SIDE); } END_TEST