From 7edcd1e6be0164603c6a3a60798dcb72fe68e774 Mon Sep 17 00:00:00 2001 From: Peter Ganzhorn Date: Tue, 24 Apr 2018 19:30:55 +0200 Subject: [PATCH] libinput: Add IBM/Lenovo Scrollpoint mice quirk to enable smooth scrolling. --- Signed-off-by: Peter Ganzhorn --- src/evdev-fallback.c | 11 +++++++++++ src/evdev.c | 1 + src/evdev.h | 1 + udev/90-libinput-model-quirks.hwdb | 15 +++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 196383d0..23706a50 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -211,6 +211,17 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch, if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) return; + if (device->model_flags & EVDEV_MODEL_SCROLLPOINT) { + struct normalized_coords unaccel = { 0.0, 0.0 }; + dispatch->wheel.y *= -1; + normalize_delta(device, &dispatch->wheel, &unaccel); + evdev_post_scroll(device, time, + LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, &unaccel); + dispatch->wheel.x = 0; + dispatch->wheel.y = 0; + return; + } + if (dispatch->wheel.y != 0) { wheel_degrees.y = -1 * dispatch->wheel.y * device->scroll.wheel_click_angle.y; diff --git a/src/evdev.c b/src/evdev.c index 95351082..3378e2f1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1286,6 +1286,7 @@ evdev_read_model_flags(struct evdev_device *device) MODEL(TABLET_NO_TILT), MODEL(TABLET_MODE_NO_SUSPEND), MODEL(LENOVO_CARBON_X1_6TH), + MODEL(SCROLLPOINT), #undef MODEL { "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL }, { NULL, EVDEV_MODEL_DEFAULT }, diff --git a/src/evdev.h b/src/evdev.h index d1290610..573921e2 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -130,6 +130,7 @@ enum evdev_device_model { EVDEV_MODEL_MS_NANO_TRANSCEIVER = (1 << 28), EVDEV_MODEL_TABLET_NO_TILT = (1 << 29), EVDEV_MODEL_TABLET_MODE_NO_SUSPEND = (1 << 30), + EVDEV_MODEL_SCROLLPOINT = (1 << 31), }; enum evdev_button_scroll_state { diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index 9dcb38e3..6c27b807 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -190,6 +190,21 @@ libinput:tablet:input:b0003v256Cp* LIBINPUT_MODEL_TABLET_NO_PROXIMITY_OUT=1 ########################################## +# IBM +########################################## +# +# IBM/Lenovo Scrollpoint mouse. Instead of a scroll wheel these mice +# feature trackpoint-like sticks which generate a huge amount of scroll +# events that need to be handled differently than scroll wheel events +libinput:mouse:b0003v04B3p3100* +libinput:mouse:b0003v04B3p3103* +libinput:mouse:b0003v04B3p3105* +libinput:mouse:b0003v04B3p3108* +libinput:mouse:b0003v04B3p3109* +libinput:mouse:b0003v17EFp6049* + LIBINPUT_MODEL_SCROLLPOINT=1 + +########################################## # LENOVO ########################################## -- 2.11.0