From c84cc660f0309a4139010be3cea631c464c52c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Fri, 25 Feb 2022 17:30:27 +0100 Subject: [PATCH] build: check if libinput supports high-res scroll Starting with Linux Kernel v5.0 two new axes are available for mice that support high-resolution wheel scrolling: REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES. Both axes send data in fractions of 120 where each multiple of 120 amounts to one logical scroll event. Fractions of 120 indicate a wheel movement less than one detent. Three new events are now available on libinput: LIBINPUT_EVENT_POINTER_SCROLL_WHEEL, LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS. These events replace the LIBINPUT_EVENT_POINTER_AXIS event, so new clients should simply ignore that event. Also, two new APIs are available to access the high-resolution data: libinput_event_pointer_get_scroll_value() and libinput_event_pointer_get_scroll_value_v120(). Add a project argument (LIBINPUT_HAS_SCROLL_VALUE120) to allow building against old versions of libinput or, where high-resolution scroll is available, support it. --- backend/libinput/meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/libinput/meson.build b/backend/libinput/meson.build index 38ba05f1..2f3ccab3 100644 --- a/backend/libinput/meson.build +++ b/backend/libinput/meson.build @@ -28,8 +28,8 @@ wlr_files += files( features += { 'libinput-backend': true } wlr_deps += libinput -# libinput hold gestures are available since 1.19.0 -add_project_arguments( +# libinput hold gestures and high resolution scroll are available since 1.19.0 +add_project_arguments([ '-DLIBINPUT_HAS_HOLD_GESTURES=@0@'.format(libinput.version().version_compare('>=1.19.0').to_int()), - language: 'c', -) + '-DLIBINPUT_HAS_SCROLL_VALUE120=@0@'.format(libinput.version().version_compare('>=1.19.0').to_int()), +], language: 'c')