summaryrefslogtreecommitdiff
path: root/test/litest-device-mouse-low-dpi.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-11-22 10:24:54 +1000
committerJosé Expósito <jose.exposito89@gmail.com>2021-08-31 08:45:01 +0200
commit6bb02aaf307a38e60ec8e6b2198d8e0c30d59a95 (patch)
tree0078abc6aa906a55afbee130e49ca5baca619604 /test/litest-device-mouse-low-dpi.c
parent427c855d21b442620bf6472c2a0585ddca9673e0 (diff)
downloadlibinput-6bb02aaf307a38e60ec8e6b2198d8e0c30d59a95.tar.gz
High-resolution scroll wheel support
Starting with kernel v5.0 two new axes are available for 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. This commit adds a new API for scroll events. Three new event types that encode the axis source in the event type name and a new API to get a normalized-to-120 value that also used by Windows and the kernel (each multiple of 120 represents a logical scroll click). This addresses a main shortcoming with the existing API - it was unreliable to calculate the click angle based on the axis value+discrete events and thus any caller using the axis value alone would be left with some ambiguity. With the v120 API it's now possible to (usually) calculate the click angle, but more importantly it provides the simplest hw-independent way of scrolling by a click or a fraction of a click. A new event type is required, the only way to integrate the v120 value otherwise was to start sending events with a discrete value of 0. This would break existing xf86-input-libinput (divide by zero, fixed in 0.28.2) and weston (general confusion). mutter, kwin are unaffected. With the new API, the old POINTER_AXIS event are deprecated - callers should use the new API where available and discard any POINTER_AXIS events. Notable: REL_WHEEL/REL_HWHEEL are emulated by the kernel but there's no guarantee that they'll come every accumulated 120 values, e.g. Logitech mice often send events that don't add up to 120 per detent. We use the kernel's wheel click emulation instead of doing our own. libinput guarantees high-resolution events even on pre-5.0 kernels. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Diffstat (limited to 'test/litest-device-mouse-low-dpi.c')
-rw-r--r--test/litest-device-mouse-low-dpi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/litest-device-mouse-low-dpi.c b/test/litest-device-mouse-low-dpi.c
index 9525058e..a01b89f1 100644
--- a/test/litest-device-mouse-low-dpi.c
+++ b/test/litest-device-mouse-low-dpi.c
@@ -39,6 +39,9 @@ static int events[] = {
EV_REL, REL_X,
EV_REL, REL_Y,
EV_REL, REL_WHEEL,
+ EV_REL, REL_WHEEL_HI_RES,
+ EV_REL, REL_HWHEEL,
+ EV_REL, REL_HWHEEL_HI_RES,
-1 , -1,
};