Skip to content

High-resolution scroll wheel support

Peter Hutterer requested to merge whot/libinput:wip/hi-res-scrolling into main

Fixes #130 (closed)

Note: functionality requires kernel v5.0 or later, libinput will emulate things correctly on older kernels.

Three new events are now available: LIBINPUT_EVENT_POINTER_AXIS_WHEEL, LIBINPUT_EVENT_POINTER_AXIS_FINGER, and LIBINPUT_EVENT_POINTER_AXIS_CONTINUOUS. These events replace the LIBINPUT_EVENT_POINTER_AXIS event, so new clients should simply ignore that event. There is no replacement for the wheel tilt axis source, it's deprecated now, see !444 (merged).

This LIBINPUT_EVENT_POINTER_AXIS_WHEEL event adds a new API libinput_pointer_axis_get_value_v120(). The libinput_pointer_axis_get_value_v120() is a mirror from the kernel API (itself a copy of the Windows API). The new event is sent for all wheel events, even those that don't technically support hires scrolling and even on older kernels that don't have this feature. So callers can simply ignore any LIBINPUT_EVENT_POINTER_AXIS event and use the new event types only.

Why new events? I couldn't make the existing pointer axis events work with existing clients and a new event is necessary. The v120 API is necessary anyway but the only way to merge this into the existing axis events was to have those send discrete events of zero. Turns out that's not something callers expect because it never happened before

  • xf86-input-libinput had a divide-by-zero bug (fixed in 0.28.2)
  • weston ends up sending scroll stop events for discrete 0
  • mutter does a lot of busywork for nothing to actually happen, which I guess is lucky
  • kwin/wlroots are fine though

Where discrete 0 events end up on the Wayland protocol (all but kwin, iirc), XWayland would scroll 200% (first based on the value, then one full movement for the discrete event). So less than ideal.

The first approach of this patchset only added LIBINPUT_EVENT_POINTER_AXIS_WHEEL and left finger/continuous on the old events but that was cumbersome to handle in clients. Much easier for everyone to deprecate the old LIBINPUT_EVENT_POINTER_AXIS event and switch to the new event types.


  • documentation still refers to the old approach
  • test suite hasn't been updated yet

cc @jadahl, @bentiss, @carlosg

Edited by Peter Hutterer

Merge request reports