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 <allan.jensen@qt.io>
This commit is contained in:
parent
95b41777bb
commit
9e15a93b89
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user