diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2022-09-05 09:35:23 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2022-09-08 09:03:15 +1000 |
commit | cef91f5b43ddcf01875d16d2e69180f4b71c5bf5 (patch) | |
tree | f5843e7ecdab53b89cba1a11ad4ae71b8bb6779c | |
parent | fc1a28951a4d0cd37150ca7a997aa9227b4d6061 (diff) | |
download | libinput-cef91f5b43ddcf01875d16d2e69180f4b71c5bf5.tar.gz |
filter: don't normalize the const filter approach
The filter vs const filter is supposed to be for accelerated vs
non-accelerated motion (e.g. pointer motion vs scrolling) - in both
cases the returned value is supposed to be in the same coordinate
system, just once with an extra accel factor applied.
This was broken in the flat and low-dpi profiles: in both of those the
accelerated filter does *not* normalize, it merely applies the fixed/adaptive factor.
The constant filter normalized however. The result was that on e.g. a
5000dpi mouse the constant motion was 5 times slower than the
accelerated motion, even with a factor of 1.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/filter-flat.c | 9 | ||||
-rw-r--r-- | src/filter-low-dpi.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/filter-flat.c b/src/filter-flat.c index 0ee6c922..4fc185ba 100644 --- a/src/filter-flat.c +++ b/src/filter-flat.c @@ -65,10 +65,11 @@ accelerator_filter_noop_flat(struct motion_filter *filter, const struct device_float_coords *unaccelerated, void *data, uint64_t time) { - struct pointer_accelerator_flat *accel = - (struct pointer_accelerator_flat *) filter; - - return normalize_for_dpi(unaccelerated, accel->dpi); + const struct normalized_coords normalized = { + .x = unaccelerated->x, + .y = unaccelerated->y, + }; + return normalized; } static bool diff --git a/src/filter-low-dpi.c b/src/filter-low-dpi.c index ffcf9114..51793b5c 100644 --- a/src/filter-low-dpi.c +++ b/src/filter-low-dpi.c @@ -150,10 +150,11 @@ accelerator_filter_noop(struct motion_filter *filter, const struct device_float_coords *unaccelerated, void *data, uint64_t time) { - struct pointer_accelerator_low_dpi *accel = - (struct pointer_accelerator_low_dpi *) filter; - - return normalize_for_dpi(unaccelerated, accel->dpi); + const struct normalized_coords normalized = { + .x = unaccelerated->x, + .y = unaccelerated->y, + }; + return normalized; } static void |