evdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel"
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 4 Sep 2022 23:26:21 +0000 (09:26 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 7 Sep 2022 23:03:15 +0000 (09:03 +1000)
Rather than normalizing manually, leave this up to the pointer acceleration
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-fallback.c
src/evdev-fallback.h
src/evdev-wheel.c

index bd5a458c7309eddbec858863d475d7b1314df604..4dcccf3b648cdf86645f65b1eed997395ccb03cd 100644 (file)
@@ -90,15 +90,6 @@ fallback_interface_get_switch_state(struct evdev_dispatch *evdev_dispatch,
                        LIBINPUT_SWITCH_STATE_OFF;
 }
 
-void
-fallback_normalize_delta(struct evdev_device *device,
-                        const struct device_coords *delta,
-                        struct normalized_coords *normalized)
-{
-       normalized->x = delta->x * DEFAULT_MOUSE_DPI / (double)device->dpi;
-       normalized->y = delta->y * DEFAULT_MOUSE_DPI / (double)device->dpi;
-}
-
 static inline bool
 post_button_scroll(struct evdev_device *device,
                   struct device_float_coords raw,
index 48be42a16132767ed853e78f1338f94aa0465ea9..27533a1af8216a171785a2478007b8f526cd971e 100644 (file)
@@ -270,10 +270,6 @@ fallback_notify_physical_button(struct fallback_dispatch *dispatch,
                                uint64_t time,
                                int button,
                                enum libinput_button_state state);
-void
-fallback_normalize_delta(struct evdev_device *device,
-                        const struct device_coords *delta,
-                        struct normalized_coords *normalized);
 
 void
 fallback_init_wheel(struct fallback_dispatch *dispatch,
index 7fcf658d5d3c7fa7b98a5e7327b6ec28cfb22fc7..7276ec1a2ca4a426189e31f6a2683de8e1ec3bf6 100644 (file)
@@ -191,14 +191,19 @@ wheel_flush_scroll(struct fallback_dispatch *dispatch,
         * trackstick data via REL_WHEEL. Normalize it like normal x/y coordinates.
         */
        if (device->model_flags & EVDEV_MODEL_LENOVO_SCROLLPOINT) {
-               struct normalized_coords unaccel = { 0.0, 0.0 };
-
-               dispatch->wheel.lo_res.y *= -1;
-               fallback_normalize_delta(device, &dispatch->wheel.lo_res, &unaccel);
+               const struct device_float_coords raw = {
+                       .x = dispatch->wheel.lo_res.x,
+                       .y = dispatch->wheel.lo_res.y * -1,
+               };
+               const struct normalized_coords normalized =
+                               filter_dispatch_constant(device->pointer.filter,
+                                                        &raw,
+                                                        device,
+                                                        time);
                evdev_post_scroll(device,
                                  time,
                                  LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,
-                                 &unaccel);
+                                 &normalized);
                dispatch->wheel.hi_res.x = 0;
                dispatch->wheel.hi_res.y = 0;
                dispatch->wheel.lo_res.x = 0;