Deprecate wheel tilt as separate axis source
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 18 May 2020 01:47:29 +0000 (11:47 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 21 May 2020 07:29:44 +0000 (07:29 +0000)
This has never been supported through the stack. No device ever had the
required MOUSE_WHEEL_TILT_VERTICAL/HORIZONTAL udev property set, so
libinput never set the right axis source. Neither weston nor mutter
added the code for it. Even if we added wheel tilt for devices now, it
would break those devices. And the benefit we get from having those
separate is miniscule at best.

So let's do the long-term thing and just deprecate this axis source.

The wheel tilt mouse test device remains in the test suite, with the
udev properties set just to verify that we do indeed ignore those now.

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

index 99c87c8..d8a0e79 100644 (file)
@@ -208,7 +208,6 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch,
 {
        struct normalized_coords wheel_degrees = { 0.0, 0.0 };
        struct discrete_coords discrete = { 0.0, 0.0 };
-       enum libinput_pointer_axis_source source;
 
        if (!(device->seat_caps & EVDEV_DEVICE_POINTER))
                return;
@@ -233,15 +232,11 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch,
                                        device->scroll.wheel_click_angle.y;
                discrete.y = -1 * dispatch->wheel.y;
 
-               source = device->scroll.is_tilt.vertical ?
-                               LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
-                               LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
-
                evdev_notify_axis(
                        device,
                        time,
                        bit(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL),
-                       source,
+                       LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
                        &wheel_degrees,
                        &discrete);
                dispatch->wheel.y = 0;
@@ -252,15 +247,11 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch,
                                        device->scroll.wheel_click_angle.x;
                discrete.x = dispatch->wheel.x;
 
-               source = device->scroll.is_tilt.horizontal ?
-                               LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
-                               LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
-
                evdev_notify_axis(
                        device,
                        time,
                        bit(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL),
-                       source,
+                       LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
                        &wheel_degrees,
                        &discrete);
                dispatch->wheel.x = 0;
index a5b1e2a..6afc862 100644 (file)
@@ -1306,21 +1306,6 @@ evdev_read_wheel_click_props(struct evdev_device *device)
        return angles;
 }
 
-static inline struct wheel_tilt_flags
-evdev_read_wheel_tilt_props(struct evdev_device *device)
-{
-       struct wheel_tilt_flags flags;
-
-       flags.vertical = parse_udev_flag(device,
-                                        device->udev_device,
-                                        "MOUSE_WHEEL_TILT_VERTICAL");
-
-       flags.horizontal = parse_udev_flag(device,
-                                        device->udev_device,
-                                        "MOUSE_WHEEL_TILT_HORIZONTAL");
-       return flags;
-}
-
 static inline double
 evdev_get_trackpoint_multiplier(struct evdev_device *device)
 {
@@ -2232,7 +2217,6 @@ evdev_device_create(struct libinput_seat *seat,
        device->scroll.direction = 0;
        device->scroll.wheel_click_angle =
                evdev_read_wheel_click_props(device);
-       device->scroll.is_tilt = evdev_read_wheel_tilt_props(device);
        device->model_flags = evdev_read_model_flags(device);
        device->dpi = DEFAULT_MOUSE_DPI;
 
index 8bc97be..b0b1b8c 100644 (file)
@@ -233,8 +233,6 @@ struct evdev_device {
                /* angle per REL_WHEEL click in degrees */
                struct wheel_angle wheel_click_angle;
 
-               struct wheel_tilt_flags is_tilt;
-
                enum evdev_button_scroll_lock_state lock_state;
                bool want_lock_enabled;
                bool lock_enabled;
index 72255ff..e50eb95 100644 (file)
@@ -111,11 +111,6 @@ struct phys_ellipsis {
        double minor;
 };
 
-/* A pair of tilt flags */
-struct wheel_tilt_flags {
-       bool vertical, horizontal;
-};
-
 struct libinput_interface_backend {
        int (*resume)(struct libinput *libinput);
        void (*suspend)(struct libinput *libinput);
index 5a19f79..9570648 100644 (file)
@@ -272,6 +272,10 @@ enum libinput_pointer_axis_source {
         * The event is caused by the tilting of a mouse wheel rather than
         * its rotation. This method is commonly used on mice without
         * separate horizontal scroll wheels.
+        *
+        * @deprecated This axis source is deprecated as of libinput 1.16.
+        * It was never used by any device before libinput 1.16. All wheel
+        * tilt devices use @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL instead.
         */
        LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT,
 };
@@ -1472,14 +1476,8 @@ libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event,
  * The coordinate system is identical to the cursor movement, i.e. a
  * scroll value of 1 represents the equivalent relative motion of 1.
  *
- * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, no
- * terminating event is guaranteed (though it may happen).
- * Scrolling is in discrete steps and there is no physical equivalent for
- * the value returned here. For backwards compatibility, the value returned
- * by this function is identical to a single mouse wheel rotation by this
- * device (see the documentation for @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL
- * above). Callers should not use this value but instead exclusively refer
- * to the value returned by libinput_event_pointer_get_axis_value_discrete().
+ * @deprecated The source @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT is
+ * deprecated as of libinput 1.16. No device has ever sent this source.
  *
  * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS,
  * this function returns 0.
index f148264..22a8bfb 100644 (file)
@@ -602,33 +602,6 @@ out:
        return angle;
 }
 
-static enum libinput_pointer_axis_source
-wheel_source(struct litest_device *dev, int which)
-{
-       struct udev_device *d;
-       bool is_tilt = false;
-
-       d = libinput_device_get_udev_device(dev->libinput_device);
-       litest_assert_ptr_notnull(d);
-
-       switch(which) {
-       case REL_WHEEL:
-               is_tilt = !!udev_device_get_property_value(d, "MOUSE_WHEEL_TILT_VERTICAL");
-               break;
-       case REL_HWHEEL:
-               is_tilt = !!udev_device_get_property_value(d, "MOUSE_WHEEL_TILT_HORIZONTAL");
-               break;
-       default:
-               litest_abort_msg("Invalid source axis %d\n", which);
-               break;
-       }
-
-       udev_device_unref(d);
-       return is_tilt ?
-               LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT :
-               LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
-}
-
 static void
 test_wheel_event(struct litest_device *dev, int which, int amount)
 {
@@ -641,7 +614,7 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
        double scroll_step, expected, discrete;
 
        scroll_step = wheel_click_angle(dev, which);
-       source = wheel_source(dev, which);
+       source = LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
        expected = amount * scroll_step;
        discrete = amount;