diff options
author | satrmb <10471-satrmb_true-email-is-private_contact-via-web@gitlab.freedesktop.org> | 2022-05-29 11:29:49 +0200 |
---|---|---|
committer | satrmb <10471-satrmb_true-email-is-private_contact-via-web@gitlab.freedesktop.org> | 2022-05-29 12:50:37 +0200 |
commit | 92233df57b07c4bbc95ec4f5ed9ce5cc896eabce (patch) | |
tree | 73adc36b2f9f2ae7e6aa34bf0ed6c188bde471d4 | |
parent | bfbcf1737b856bbda5b0271247b8708fbff5e232 (diff) | |
download | libinput-92233df57b07c4bbc95ec4f5ed9ce5cc896eabce.tar.gz |
filter-touchpad: normalize for dpi on the touchpad-specific flat profile
On mice, switching the acceleration profile to flat disables dpi normalization,
because high or even switchable dpi are generally major features of a
high-end mouse, and switching to flat acceleration indicates that the user
wants to reduce the effects of any cursor acceleration to a minimum.
Therefore we skip normalization there and let the user take full advantage
of their expensive hardware.
On touchpads, particularly those built into a laptop, users have to deal with
whatever hardware they have; touchpad dpi is an afterthought at best, or
a disaster at worst. Switching to the flat profile is more likely to be
about avoiding the non-linear acceleration curve of the adaptive profile.
Hence the flat profile for touchpads shouldn't copy what the one for mice does,
but rather use dpi normalization like the adaptive profile. This keeps flat
acceleration on low-resolution touchpads from dropping to unusably slow speeds.
Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
-rw-r--r-- | src/filter-touchpad-flat.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/filter-touchpad-flat.c b/src/filter-touchpad-flat.c index 658d5b5d..e69e7afa 100644 --- a/src/filter-touchpad-flat.c +++ b/src/filter-touchpad-flat.c @@ -49,18 +49,19 @@ accelerator_filter_touchpad_flat(struct motion_filter *filter, const struct device_float_coords *unaccelerated, void *data, uint64_t time) { - struct touchpad_accelerator_flat *accel_filter = + struct touchpad_accelerator_flat *accel = (struct touchpad_accelerator_flat *)filter; double factor; /* unitless factor */ - struct normalized_coords accelerated; + struct normalized_coords normalized; /* You want flat acceleration, you get flat acceleration for the * device */ - factor = accel_filter->factor; - accelerated.x = TP_MAGIC_SLOWDOWN_FLAT * factor * unaccelerated->x; - accelerated.y = TP_MAGIC_SLOWDOWN_FLAT * factor * unaccelerated->y; + factor = accel->factor; + normalized = normalize_for_dpi(unaccelerated, accel->dpi); + normalized.x = TP_MAGIC_SLOWDOWN_FLAT * factor * normalized.x; + normalized.y = TP_MAGIC_SLOWDOWN_FLAT * factor * normalized.y; - return accelerated; + return normalized; } static struct normalized_coords |