From 9e15a93b89a46605e224666bffc62b342d4dc73b Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 19 Jun 2018 15:34:14 +0200 Subject: [PATCH] Fix mouse-wheel handling for evdev devices with extended values Newer mouse devices support a so-called "free-scroll" mode, which unlocks the wheel and allows for faster scrolling. For such input devices, evdev will report an event value greater than 1, when free scrolling is active. Examples for such devices would be the Logitech G700 or MX Master series. However QEvdevMouseHandler interpreted such an event's data incorrectly and triggered wheel events for the opposite scrolling direction. This also often resulted in jittery & jumpy scrolling, when the events' values alternated between 1 and 2. Change-Id: Ibb23ed4419d647fff9b90d371d5bb4037cf2bd9b Reviewed-by: Allan Sandfeld Jensen --- .../input/evdevmouse/qevdevmousehandler.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index 04372ae4d9..86a4cd0076 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -245,18 +245,12 @@ void QEvdevMouseHandler::readMouseData() m_y += data->value; posChanged = true; } else if (data->code == ABS_WHEEL) { // vertical scroll - // data->value: 1 == up, -1 == down - if (data->value == 1) - delta.setY(120); - else - delta.setY(-120); + // data->value: positive == up, negative == down + delta.setY(120 * data->value); emit handleWheelEvent(delta); } else if (data->code == ABS_THROTTLE) { // horizontal scroll - // data->value: 1 == right, -1 == left - if (data->value == 1) - delta.setX(-120); - else - delta.setX(120); + // data->value: positive == right, negative == left + delta.setX(-120 * data->value); emit handleWheelEvent(delta); } } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {