summaryrefslogtreecommitdiff
path: root/tools/shared.h
diff options
context:
space:
mode:
authorYinon Burgansky <yinonburgansky@gmail.com>2022-12-13 00:23:59 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2023-01-17 01:46:17 +0000
commit5324f425a1635fb95356461c34e43d72590c9023 (patch)
tree3179a0ec9904e1d8eae11e5fa638fbadeea0d6e4 /tools/shared.h
parentee3330491d368096a36043661466e6a911af3576 (diff)
downloadlibinput-5324f425a1635fb95356461c34e43d72590c9023.tar.gz
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>
Diffstat (limited to 'tools/shared.h')
-rw-r--r--tools/shared.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/shared.h b/tools/shared.h
index fc59ae00..825a51f5 100644
--- a/tools/shared.h
+++ b/tools/shared.h
@@ -59,6 +59,9 @@ enum configuration_options {
OPT_PROFILE,
OPT_DISABLE_SENDEVENTS,
OPT_APPLY_TO,
+ OPT_CUSTOM_POINTS,
+ OPT_CUSTOM_STEP,
+ OPT_CUSTOM_TYPE,
};
#define CONFIGURATION_OPTIONS \
@@ -87,7 +90,10 @@ enum configuration_options {
{ "set-profile", required_argument, 0, OPT_PROFILE }, \
{ "set-tap-map", required_argument, 0, OPT_TAP_MAP }, \
{ "set-speed", required_argument, 0, OPT_SPEED },\
- { "apply-to", required_argument, 0, OPT_APPLY_TO }
+ { "apply-to", required_argument, 0, OPT_APPLY_TO },\
+ { "set-custom-points", required_argument, 0, OPT_CUSTOM_POINTS },\
+ { "set-custom-step", required_argument, 0, OPT_CUSTOM_STEP },\
+ { "set-custom-type", required_argument, 0, OPT_CUSTOM_TYPE }
enum tools_backend {
BACKEND_NONE,
@@ -114,6 +120,10 @@ struct tools_options {
int dwtp;
enum libinput_config_accel_profile profile;
char disable_pattern[64];
+ enum libinput_config_accel_type custom_type;
+ double custom_step;
+ size_t custom_npoints;
+ double *custom_points;
};
void tools_init_options(struct tools_options *options);