[PATCH libinput 12/12] evdev: don't provide button scrolling on absolute pointer devices

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 20 20:53:39 UTC 2017


This may be a feature for the future but for now be honest and don't claim
that button-based scrolling is available, it's not hooked up in the absolute
code path.

https://bugs.freedesktop.org/show_bug.cgi?id=99865

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c         | 4 +++-
 test/test-pointer.c | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/evdev.c b/src/evdev.c
index d50f9bb..6132d54 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2688,7 +2688,9 @@ evdev_configure_device(struct evdev_device *device)
 		/* want natural-scroll config option */
 		device->scroll.natural_scrolling_enabled = true;
 		/* want button scrolling config option */
-		device->scroll.want_button = 1;
+		if (libevdev_has_event_code(evdev, EV_REL, REL_X) ||
+		    libevdev_has_event_code(evdev, EV_REL, REL_Y))
+			device->scroll.want_button = 1;
 	}
 
 	if (udev_tags & EVDEV_UDEV_TAG_KEYBOARD) {
diff --git a/test/test-pointer.c b/test/test-pointer.c
index 8498da9..06c45b2 100644
--- a/test/test-pointer.c
+++ b/test/test-pointer.c
@@ -2086,6 +2086,7 @@ litest_setup_tests_pointer(void)
 	litest_add_for_device("pointer:button", pointer_button_has_no_button, LITEST_KEYBOARD);
 	litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_TABLET);
 	litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
+	litest_add("pointer:scroll", pointer_scroll_button_noscroll, LITEST_ABSOLUTE|LITEST_BUTTON, LITEST_RELATIVE);
 	litest_add("pointer:scroll", pointer_scroll_button_noscroll, LITEST_ANY, LITEST_RELATIVE|LITEST_BUTTON);
 	litest_add("pointer:scroll", pointer_scroll_button_no_event_before_timeout, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
 	litest_add("pointer:scroll", pointer_scroll_button_middle_emulation, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
-- 
2.9.3



More information about the wayland-devel mailing list