diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2015-08-27 13:13:47 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-09-11 00:54:01 +1000 |
commit | 8d9e7a1bcf8eac3a344d8c1135b2b546c37e8b04 (patch) | |
tree | 72229c2a0e52505bfc90f8f3ea2063ead02fd3a4 /tools/libinput-list-devices.c | |
parent | 0c7ef582ebeceb567b2972de2163e9156c7b6283 (diff) |
Add an API to change pointer acceleration profiles
The quartett of new config functions is:
libinput_device_config_accel_get_profiles
libinput_device_config_accel_get_profile
libinput_device_config_accel_set_profile
libinput_device_config_accel_get_default_profile
The profile defines how the pointer acceleration works, from a very high-level
perspective. Two profiles are on offer, "adaptive", the standard one we have
used so far and "flat" which is a simple multiplier of input deltas and
provides 1:1 mapping of device movement vs pointer movement.
The speed setting is on top of the profile, a speed of 0 (default) is the
equivalent to "no pointer acceleration". This is popular among gamers and
users of switchable-dpi mice.
The flat profile unnormalizes the deltas, i.e. you get what the device does
and any device below 800dpi will feel excruciatingly slow. The speed range
[-1, 1] maps into 0-200% of the speed. At 200%, a delta of 1 is translated
into a 2 pixel movement, anything higher makes it rather pointless.
The flat profile is currently available for all pointer devices but touchpads.
https://bugs.freedesktop.org/show_bug.cgi?id=89485
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tools/libinput-list-devices.c')
-rw-r--r-- | tools/libinput-list-devices.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c index c156bf0..21685d9 100644 --- a/tools/libinput-list-devices.c +++ b/tools/libinput-list-devices.c @@ -172,6 +172,35 @@ click_defaults(struct libinput_device *device) return str; } +static char* +accel_profiles(struct libinput_device *device) +{ + uint32_t profiles; + char *str; + enum libinput_config_accel_profile profile; + + if (!libinput_device_config_accel_is_available(device)) { + xasprintf(&str, "n/a"); + return str; + } + + profiles = libinput_device_config_accel_get_profiles(device); + if (profiles == LIBINPUT_CONFIG_ACCEL_PROFILE_NONE) { + xasprintf(&str, "none"); + return str; + } + + profile = libinput_device_config_accel_get_default_profile(device); + xasprintf(&str, + "%s%s%s%s", + (profile == LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) ? "*" : "", + (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) ? "flat" : "", + (profile == LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "*" : "", + (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "adaptive" : ""); + + return str; +} + static const char * dwt_default(struct libinput_device *device) { @@ -249,6 +278,10 @@ print_device_notify(struct libinput_event *ev) printf("Disable-w-typing: %s\n", dwt_default(dev)); + str = accel_profiles(dev); + printf("Accel profiles: %s\n", str); + free(str); + printf("\n"); } |