diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2022-09-05 09:56:16 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2022-09-08 09:03:15 +1000 |
commit | 7ba0af575bee044145bda280ad2f5d7b1e7af479 (patch) | |
tree | 9439eece7b1ab20af78cb96857a9b98ac9ffaf16 | |
parent | 49707691c8ee8d167ef2dca558e31b5f6cf6d68c (diff) | |
download | libinput-7ba0af575bee044145bda280ad2f5d7b1e7af479.tar.gz |
filter: apply the same factor for constant motion as for normal motion
Users that want a flat pointer acceleration want the input speed to
match 1:1 to the output speed, barring a fixed constant multiplier.
This will apply to things like button scrolling as well, so let's map
the constant accel function to the non-constant accel functions to the
speed setting applies to every movement.
This is applied to both the flat and the touchpad flat filter.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/filter-flat.c | 17 | ||||
-rw-r--r-- | src/filter-touchpad-flat.c | 21 |
2 files changed, 24 insertions, 14 deletions
diff --git a/src/filter-flat.c b/src/filter-flat.c index 4fc185ba..3f5d9bd9 100644 --- a/src/filter-flat.c +++ b/src/filter-flat.c @@ -65,11 +65,18 @@ accelerator_filter_noop_flat(struct motion_filter *filter, const struct device_float_coords *unaccelerated, void *data, uint64_t time) { - const struct normalized_coords normalized = { - .x = unaccelerated->x, - .y = unaccelerated->y, - }; - return normalized; + /* We map the unaccelerated flat filter to have the same behavior as + * the "accelerated" flat filter. + * The filter by definition is flat, i.e. it does not actually + * apply any acceleration (merely a constant factor) and we can assume + * that a user wants all mouse movement to have the same speed, mapped + * 1:1 to the input speed. + * + * Thus we apply the same factor to our non-accelerated motion - this way + * things like button scrolling end up having the same movement as + * pointer motion. + */ + return accelerator_filter_flat(filter, unaccelerated, data, time); } static bool diff --git a/src/filter-touchpad-flat.c b/src/filter-touchpad-flat.c index 34867af3..9c0075bd 100644 --- a/src/filter-touchpad-flat.c +++ b/src/filter-touchpad-flat.c @@ -69,15 +69,18 @@ accelerator_filter_noop_touchpad_flat(struct motion_filter *filter, const struct device_float_coords *unaccelerated, void *data, uint64_t time) { - struct touchpad_accelerator_flat *accel = - (struct touchpad_accelerator_flat *) filter; - struct normalized_coords normalized; - - normalized = normalize_for_dpi(unaccelerated, accel->dpi); - normalized.x = TP_MAGIC_SLOWDOWN_FLAT * normalized.x; - normalized.y = TP_MAGIC_SLOWDOWN_FLAT * normalized.y; - - return normalized; + /* We map the unaccelerated flat filter to have the same behavior as + * the "accelerated" flat filter. + * The filter by definition is flat, i.e. it does not actually + * apply any acceleration (merely a constant factor) and we can assume + * that a user wants all mouse movement to have the same speed, mapped + * 1:1 to the input speed. + * + * Thus we apply the same factor to our non-accelerated motion - this way + * things like gestures end up having the same movement as + * pointer motion. + */ + return accelerator_filter_touchpad_flat(filter, unaccelerated, data, time); } static bool |