Change the scroll step distance to 15 and document it as degrees
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 9 Jan 2015 07:03:45 +0000 (17:03 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 13 Jan 2015 03:35:42 +0000 (13:35 +1000)
Similar to the mouse resolution, let's make the scroll distance a sensible
predictable value. Most mice use a 15 degree angle per scroll click, so let's
change to that. This will alter behaviour in clients that expect 10.

We return doubles for the axis value, so that leaves the option of
really fine-grained step sizes in the future.

We currently assume all mice have 15 degree angles. Like the DPI settings, it
will require a udev property to be set. Patch for that to follow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
src/evdev.c
src/libinput.h
test/pointer.c

index 1718491d77beed5b1f8c141373e1de987b750d1a..d8b61299e40735d75cac2883237d8d6b595675e0 100644 (file)
@@ -40,7 +40,7 @@
 #include "filter.h"
 #include "libinput-private.h"
 
-#define DEFAULT_AXIS_STEP_DISTANCE 10
+#define DEFAULT_WHEEL_CLICK_ANGLE 15
 #define DEFAULT_MIDDLE_BUTTON_SCROLL_TIMEOUT 200
 
 enum evdev_key_type {
@@ -577,7 +577,7 @@ evdev_process_relative(struct evdev_device *device,
                        time,
                        LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
                        LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
-                       -1 * e->value * DEFAULT_AXIS_STEP_DISTANCE);
+                       -1 * e->value * DEFAULT_WHEEL_CLICK_ANGLE);
                break;
        case REL_HWHEEL:
                evdev_flush_pending_event(device, time);
@@ -586,7 +586,7 @@ evdev_process_relative(struct evdev_device *device,
                        time,
                        LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
                        LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
-                       e->value * DEFAULT_AXIS_STEP_DISTANCE);
+                       e->value * DEFAULT_WHEEL_CLICK_ANGLE);
                break;
        }
 }
index d0518cc68cade15d5f169fc7b27c2dca151783ae..f605e52b5cc69ea12e524a529c6d0c6f95027fbb 100644 (file)
@@ -704,10 +704,10 @@ libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event);
  *
  * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, no terminating
  * event is guaranteed (though it may happen).
- * Scrolling is in discrete steps, a value of 10 representing one click
- * of a typical mouse wheel. Some mice may have differently grained wheels,
- * libinput will adjust the value accordingly. It is up to the caller how to
- * interpret such different step sizes.
+ * Scrolling is in discrete steps, the value is the angle the wheel moved
+ * in degrees. The default is 15 degrees per wheel click, but some mice may
+ * have differently grained wheels. It is up to the caller how to interpret
+ * such different step sizes.
  *
  * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, no
  * terminating event is guaranteed (though it may happen).
index b9bd3cc8b5b50ab40c1e3e502b82aae98ae2d973..d12c9f6b6c994bbaf68e1c8dc846421a98afcab2 100644 (file)
@@ -350,8 +350,8 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
        struct libinput_event_pointer *ptrev;
 
        /* the current evdev implementation scales the scroll wheel events
-          up by a factor 10 */
-       const int scroll_step = 10;
+          up by a factor 15 */
+       const int scroll_step = 15;
        int expected = amount * scroll_step;
 
        if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device))