Introduce custom acceleration profile
authorYinon Burgansky <yinonburgansky@gmail.com>
Mon, 12 Dec 2022 22:23:59 +0000 (00:23 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 17 Jan 2023 01:46:17 +0000 (01:46 +0000)
commit5324f425a1635fb95356461c34e43d72590c9023
tree3179a0ec9904e1d8eae11e5fa638fbadeea0d6e4
parentee3330491d368096a36043661466e6a911af3576
Introduce custom acceleration profile

The custom acceleration profile allow the user to define custom
acceleration functions for each movement type per device, giving
full control over accelerations behavior at different speeds.

This commit introduces 2 movement types which corresponds to the
2 profiles currently in use by libinput.

regular filter is Motion type.
constant filter is Fallback type.

This allows possible expansion of new movement types for the
different devices.

The custom pointer acceleration profile gives the user full control over the
acceleration behavior at different speeds.
The user needs to provide a custom acceleration function f(x) where
the x-axis is the device speed and the y-axis is the pointer speed.

The user should take into account the native device dpi and screen dpi in
order to achieve the desired behavior/feel of the acceleration.

The custom acceleration function is defined using n points which are spaced
uniformly along the x-axis, starting from 0 and continuing in constant steps.
There by the points defining the custom function are:
(0 * step, f[0]), (1 * step, f[1]), ..., ((n-1) * step, f[n-1])
where f is a list of n unitless values defining the acceleration
factor for each velocity.
When a velocity value does not lie exactly on those points, a linear
interpolation of the two closest points will be calculated.
When a velocity value is greater than the max point defined, a linear
extrapolation of the two biggest points will be calculated.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
21 files changed:
doc/user/pointer-acceleration.rst
meson.build
src/evdev-mt-touchpad.c
src/evdev.c
src/filter-custom.c [new file with mode: 0644]
src/filter-private.h
src/filter.c
src/filter.h
src/libinput-private.h
src/libinput.c
src/libinput.h
src/libinput.sym
src/util-strings.h
src/util-time.h
test/test-pointer.c
test/test-utils.c
tools/libinput-debug-events.man
tools/libinput-list-devices.c
tools/ptraccel-debug.c
tools/shared.c
tools/shared.h