Commit d84e0035 authored by Peter Hutterer's avatar Peter Hutterer

Implement the custom acceleration curve options

One new property, and the existing accel profile gets extended to keep one
extra value. The new property libinput Accel Curve Points is a list of pairs
of points to be added to the acceleration curve.

libinput only supports adding points to the curve so we simply declare the
behavior as undefined when the curve is set multiple times. Also helps to
identify those that bother to read the man page before playing with random
driver values.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <>
parent 6c75acfc
......@@ -47,6 +47,23 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto [inputproto >= 2.2])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.4.901])
AC_MSG_CHECKING([if libinput_device_config_accel_set_curve_point is available])
[AC_LANG_PROGRAM([[#include <libinput.h>]],
[[libinput_device_config_accel_set_curve_point(NULL, 0, 0)]])],
[libinput_device_config_accel_set_curve_point() is available])
# Define a configure option for an alternate input module directory
......@@ -73,6 +73,14 @@
only one is enabled at a time at max */
#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED "libinput Accel Profile Enabled"
/* Pointer accel custom curve: FLOAT, n values for n>=0 && n%2 == 0, where
each pair of values are the x/y coordinates of the acceleration curve.
The exact behavior depends on the acceleration profile.
This property should be considered write-only, the value of the property may
not reflect the actual curve points used in libinput. */
#define LIBINPUT_PROP_ACCEL_CURVE_POINTS "libinput Accel Curve Points"
/* Natural scrolling: BOOL, 1 value */
#define LIBINPUT_PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"
......@@ -45,11 +45,19 @@ are supported:
Sets the pointer acceleration profile to the given profile. Permitted values
.BI adaptive,
.BI flat.
.BI flat,
.BI device-speed-curve.
Not all devices support this option or all profiles. If a profile is
unsupported, the default profile for this device is used. For a description
on the profiles and their behavior, see the libinput documentation.
.TP 7
.BI "Option \*qAccelCurvePoints\*q \*q" string \*q
A string of space-separated pairs of floats, each pair value separated by a
colon, i.e. the string looks like this "A:B C:D". These pairs represent the
x/y value of a point on the acceleration curve. See
for details.
.TP 7
.BI "Option \*qAccelSpeed\*q \*q" float \*q
Sets the pointer acceleration speed within the range [-1, 1]
.TP 7
......@@ -204,16 +212,26 @@ on the device. The following properties are provided by the
.TP 7
.BI "libinput Accel Profiles Available"
2 boolean values (8 bit, 0 or 1), in order "adaptive", "flat".
Indicates which acceleration profiles are available on this device.
3 boolean values (8 bit, 0 or 1), in order "adaptive", "flat",
"device-speed-curve". Indicates which acceleration profiles are available on
this device.
.TP 7
.BI "libinput Accel Profile Enabled"
2 boolean values (8 bit, 0 or 1), in order "adaptive", "flat".
Indicates which acceleration profile is currently enabled on this device.
3 boolean values (8 bit, 0 or 1), in order "adaptive", "flat",
"device-speed-curve". Indicates which acceleration profile is currently
enabled on this device.
.TP 7
.BI "libinput Accel Speed"
1 32-bit float value, defines the pointer speed. Value range -1, 1
.TP 7
.BI "libinput Accel Curve Points"
n 32-bit float values, n is a multiple of 2, each pair represents one point
on the acceleration curve. If the acceleration profile is
\fBdevice-speed-curve\fR, each value x is the device speed in units/ms and each
value x+1 is the acceleration factor to apply. This property should only be
written once per profile change, see section
.TP 7
.BI "libinput Button Scrolling Button"
1 32-bit value. Sets the button number to use for button scrolling. This
setting is independent of the scroll method, to enable button scrolling the
......@@ -381,6 +399,31 @@ it takes left-handed-ness into account.
This feature is provided by this driver, not by libinput.
Some profiles require the acceleration curve to be provided
by the user. These curve points must be provided as pairs in the option or
the property and each curve point defines the x/y value of one point on the
curve. libinput does linear interpolation between the defined points. See
the libinput documentation for details.
If the profile is
.B device-speed-curve,
the points represent the mapping of device speed (in device units/ms) to an
acceleration factor, e.g. the values (50, 2) map a device speed of 50
units/ms to an acceleration factor of 2. The current delta is then
multiplied by that factor.
To apply a custom acceleration curve, first set the profile to
.B device-speed-curve,
then set the curve points. All curve points must be set with one property
update. Once set, adding, removing or otherwise modifying the property
values results in undefined behavior.
To reset the curve, change to a different acceleration profile, then change
back to
.B device-speed-curve
before applying the new set of curve points.
This driver does not work with \fBOption \*qDevice\*q\fR set to an event
node in \fI/dev/input/by-id\fR and \fI/dev/input/by-path\fR. This can be
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment