Fix XI2 smooth scroll with inverted direction

When touchpad scroll direction is inverted, verticalIncrement and
horizontalIncrement of scrollingDevice are negative, and rawDelta
remains unfilled. It leads to pixelDelta.isNull() being true in wheel
event handler even when XI2 smooth scrolling is available on the system.

Fix that and fill rawDelta with correct values when inverted scroll
direction is used.

Change-Id: I9c0bdbad2c6b9bbed765eaa895dca300c5c70e86
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
bb10
Maxim Mikityanskiy 2015-08-09 13:47:12 +03:00 committed by Allan Sandfeld Jensen
parent ad5c768fc8
commit 33c9059f03
1 changed files with 4 additions and 0 deletions

View File

@ -859,6 +859,8 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin
// We do not set "pixel" delta if it is only measured in ticks.
if (scrollingDevice.verticalIncrement > 1)
rawDelta.setY(delta);
else if (scrollingDevice.verticalIncrement < -1)
rawDelta.setY(-delta);
}
}
if (scrollingDevice.orientations & Qt::Horizontal) {
@ -869,6 +871,8 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin
// We do not set "pixel" delta if it is only measured in ticks.
if (scrollingDevice.horizontalIncrement > 1)
rawDelta.setX(delta);
else if (scrollingDevice.horizontalIncrement < -1)
rawDelta.setX(-delta);
}
}
if (!angleDelta.isNull()) {