From bf8dc2e2ed0780b947eccfc9ac3694c518dee605 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 23 Jan 2019 09:01:24 +1000 Subject: Upgrade the default scroll distance to 120 This is just a number, to be used as divider and shouldn't have any effect in correctly written clients. With the high-res scrolling coming up however, we have a few devices where the dist cannot be expressed as an integer fraction of 15, so let's up it to 120 because we know all hardware wheels have to be an integer fraction of that that, thanks to Microsoft's API requirements. For non-wheel scrolls we need to now map into the new range. Previously we just passed the scroll events on from the touchpad/button scrolling, meaning a vdist of 15 meant 15 "libinput pixels" of scrolling resulted in a logical wheel click. Now that we have 120 as vdist, we need to times the input data by 8 to keep the same proportions. See 39b0bb4585106a56a51236d8e9843b2da8d745a5 for the previous revert. Signed-off-by: Peter Hutterer --- src/xf86libinput.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xf86libinput.c b/src/xf86libinput.c index 33b02da..adbc724 100644 --- a/src/xf86libinput.c +++ b/src/xf86libinput.c @@ -1652,8 +1652,11 @@ calculate_axis_value(struct xf86libinput *driver_data, * device. The user may change the ScrollPixelDistance * though, so where we have a dist of 10 but an increment of * 15, we need to scale from 0..10 into 0..15. + * + * We now switched to vdist of 120, so make this + * proportionate - 120/15 is 8. */ - value = value/dist * SCROLL_INCREMENT; + value = value/dist * SCROLL_INCREMENT * 8; } *value_out = value; @@ -3585,8 +3588,8 @@ xf86libinput_pre_init(InputDriverPtr drv, * affect touchpad scroll speed. For wheels it doesn't matter as * we're using the discrete value only. */ - driver_data->scroll.v.dist = SCROLL_INCREMENT; - driver_data->scroll.h.dist = SCROLL_INCREMENT; + driver_data->scroll.v.dist = 120; + driver_data->scroll.h.dist = 120; if (!is_subdevice) { if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER)) -- cgit v1.2.3