Commit graph

15 commits

Author SHA1 Message Date
Peter Hutterer
2f2bd357bc plugin: don't register the mouse-wheel plugin for passthrough devices
If a device is immediately set to PASSTHROUGH let's skip registering
this plugin for this device. We're not doing anything with the events
anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
2025-08-19 15:22:49 +10:00
Peter Hutterer
b2cd9c69a0 plugin: remove the event frame callbacks when disabling a plugin
In all cases we remove the device's handling from the plugin so let's
remove the event frame callback for this device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
2025-08-19 15:22:49 +10:00
Peter Hutterer
3ff1a2e24d plugin: when disabling wheel-debouncing set to the correct enum value
This isn't a boolean. Let's change the first enum value to something
truthy so any use as boolean is more likely to trigger test failures.

Fixes: 18992b2ec0 ("plugin: allow disabling the wheel debouncing feature")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
2025-08-19 15:22:49 +10:00
Peter Hutterer
18992b2ec0 plugin: allow disabling the wheel debouncing feature
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
d1dbbb7328 plugin: register plugins for the plugin-specific usages
The debounce, wheel/wheel-low-res, double-tool and eraser-button plugins can limit
themselves to a specific usage.

The mtdev plugin needs to pass each each event to mtdev and the proximity
timer plugin needs to get each event's timestamp so they cannot be
restricted.

The forced-tool could be restricted but effectively any event on the
devices it works on will have one of those usages set so there's no
point.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1271>
2025-08-01 14:29:44 +10:00
gudvinr
975ce6dbf5 plugin/wheel: reduce ACC_V120_THRESHOLD
For mice with multipliers 30/120 and 40/120 nothing would change
as both will still cross threshold only after 2nd event.

But for MX Master 3 (and maybe others) that makes scroll beginning
a bit responsive, without jumping straight to 64/120 or 72/120.

Now events being emitted at 16+16+16 or 24+24 without significant
side-effects ("twitching" when resting finger on the wheel,
sudden scroll events when pressing middle button, etc). See !1262 for
some background.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1267>
2025-07-12 10:28:17 +03:00
Peter Hutterer
6cdf46f857 plugins: restore the wheel plugin specifically for the MX Master 3
The MX Master 3 is difficult, its wheel events are all over the place
and heuristics are tricky to determine. The previous plugin behavior
was seemingly sufficient for the MX Master but not for other devices.

Restore the old behavior if the quirk is set for a device by adding a
fourth state ALWAYS_ACCUMULATE. In this state the min movement is never
updated from the original threshold, causing any wheel motion to
accumulate.

Ref: ca6b82841c ("plugin/wheel: tighten the wheel debouncing code")
Ref: bb05e0d1b5 ("plugin/wheel: don't accumulate for low HID resolution multipliers")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:24 +00:00
Peter Hutterer
bb05e0d1b5 plugin/wheel: don't accumulate for low HID resolution multipliers
Accumulating (and partially discarding) scroll wheel events serves to
debounce a scroll wheel and provide for more fluid scrolling where
scroll wheels can send events going in the wrong direction.

This is unlikely to happen on devices with low resolution multipliers
(i.e. where some significant physical movement by the wheel is required
to trigger events) so let's make it contingent on devices more likely to
have flaky wheels.

The magic threshold picked is 30 (HID resolution multiplier of 4) as a
guess. The resolution multiplier isn't accessible in userspace so we
have to heuristically get to it - typical interaction with a mouse will
have that value set within the first two, three scroll wheel events
though.

Closes #1150

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1261>
2025-07-09 01:46:41 +00:00
Peter Hutterer
ca6b82841c plugin/wheel: tighten the wheel debouncing code
The previous approach had a fixed threshold of 60 (half a detent)
below which scroll events were ignored. Reduce this threshold to have a
threshold of one device-specific delta. That threshold adjusts over time
to the device's individual minimum delta so after a few scroll event it
should settle on the lowest value possible.

The result is that fine-grained scrolling is possible on those devices
and only the very first scroll event is held back/swallowed, two events
in the same direction release scrolling.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1258>
2025-07-09 01:29:57 +00:00
Peter Hutterer
075a6dfaef plugin/wheel: ratelimit the 'missing hires' warning to once a day
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
9b7f933797 plugin/wheel: don't cancel the timer before re-setting it
Not needed and it saves us a bit of busywork.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
892e5d35c7 plugin: use evdev_frame_append_one() for simpler code
Instead of creating a struct and passing it in as array let's use the
helper function.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
31854a829a plugin: only register the wheel plugin on devices that have a wheel
Touchpad devices are pointers too in libinput but they don't usually
have wheels. Let's check for REL_WHEEL in device_new *and* then again
for the actual pointer capability in device_added.

Fixes: d1800a76fe ("evdev: Handle scroll wheel with a plugin")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
2a1095924b Run clang-format over the code
This uses the .clang-format file in the follow-up commit, but committed
prior to that to ease review of said file and various integrations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:42:44 +10:00
José Expósito
d1800a76fe evdev: Handle scroll wheel with a plugin
Transform the code present in evdev-wheel.c into a internal plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00