Commit graph

16 commits

Author SHA1 Message Date
Peter Hutterer
a202ed6115 Use a newtype usec_t for timestamps for better type-safety
This avoids mixing up milliseconds and usec, both by failing if
we're providing just a number somewhere we expect usecs and also
by making the API blindingly obvious that we're in usecs now.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1373>
2025-12-12 04:15:15 +00:00
Yinon Burgansky
a12dc6eba3 filter: differentiate scroll wheel from button scrolling to fix wheel speed
Commit 94b7836456 ("filter: support accelerating high-resolution
scroll wheel events") introduced a regression where high-res scroll
wheel events were incorrectly normalized by DPI. Mice with non-default
DPI (e.g., Logitech G502 at 2400 DPI) had their scroll wheel speed
reduced by the DPI ratio (1000/2400), resulting in 2-3x slower
scrolling.

The "noop" filter functions were actually performing DPI normalization
or applying a constant acceleration factor, which is appropriate for
button scrolling but incorrect for scroll wheels that have their own
units.

Add a filter_scroll_type enum (CONTINOUS, WHEEL, FINGER to match the
public events) passed through the filter_scroll interface. Update all
filter implementations to skip acceleration and normalization for wheel
events while maintaining existing behavior for button scrolling and
touchpad scrolling.

The custom acceleration profile continues to accelerate high-res wheel
events as designed.

Fixes: 94b7836456 ("filter: support accelerating high-resolution scroll wheel events")

Closes: #1212

Signed-off-by: Yinon Burgansky <yinonburgansky@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1363>
2025-11-11 14:43:41 +10: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
Yinon Burgansky
93135c2012 filter: add scroll movement type to the custom acceleration profile
Adds a dedicated scroll movement type to the custom acceleration profile.
Supported by physical mouse and touchpad.
Other profiles remain the same by using the same unaccelerated filter for the scroll filter.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2023-02-24 13:01:34 +02:00
Peter Hutterer
d199c6d8c1 filter: add helper functions to create/destroy a delta smoothener
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-17 10:51:33 +10:00
Peter Hutterer
a5dd45e8ce Remove duplicate empty lines in our source
We only touch src and tools, imported headers from include are not ours
to change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
fc1a28951a filter: constify the interfaces and make them static
No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Konstantin Kharlamov
4b219c03ac filter-trackpoint.c: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Kim Lindberger
99334e11bf
Add quirk to control velocity averaging, disable it by default
libinput applies averaging to the velocity of most pointer devices. Averaging
the velocity makes the motion look smooth and may be of benefit to bad input
devices. For good devices, however, it comes at the unfortunate price of
decreased accuaracy.

This change turns velocity averaging off by default (sets ntrackers to 2 instead
of 16) and allows for it to be turned back on via a quirk, for bad devices which
require it.
2018-08-22 12:12:55 +02:00
Peter Hutterer
77f9a47996 filter: always init a delta smoothener for 10/10ms on trackpoints
If the trackpoint gives us deltas with less than 10ms intervals, something is
wrong. Could be bad hardware, a glitch in the matrix or a discontinuity in
the otherwise appropriately named time-space continuum. Usually it's the
first.

Let's always set up trackpoint delta smoothening for 10ms to improve the
pointer speed calculation and avoid jerky behaviors. i.e. if a trackpoint
delta comes in below 10ms, pretend it came in with a 10ms interval for
calculating the speed.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/104

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-06 15:24:04 +10:00
Peter Hutterer
27f7a66de4 filter: add a trackpoint multiplier factor
Measuring the trackpoint range has not shown to be sufficient or precise
enough to be used as an ingredient for trackpoint acceleration. So let's just
switch back to a generic multiplier that we can apply to the input deltas do
undo any device-specific lack of scaling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
6dca5df806 filter: make the trackpoint accel profile func the same prototype as the others
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
831ce3c0d3 filter: replace the trackpoint accel with a velocity-based one
This gets rid of the trackpoint range propery that we've been parsing until
now and instead just opts for a basic curve with some deceleration for low
pressure. The speed range is taken from the touchpad and should be wide enough
for most trackpoints that fall within the expected range.

Trackpoints like the new ALPS ones need to be configured through a hwdb (this
part is currently missing).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 16:04:59 +10:00
Peter Hutterer
483123d490 filter: cap trackpoint scale factor at 1.0
Otherwise we scale up lower-resolution trackpoints' movements, resulting in a
jumpy cursor.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-05 10:45:07 +10:00
Chow Loong Jin
8e30b3069c Bump TRACKPOINT_DEFAULT_MAX_DELTA to 120
This raises the trackpoint speed limit to something more conducive to
long-distance moves.

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

Signed-off-by: Chow Loong Jin <hyperair@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-21 14:59:06 +10:00
Peter Hutterer
477f51b6bd filter: split trackpoint acceleration code into a separate file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-18 16:15:38 +10:00