From 33c9059f03a67d83123933426ea9164d57399d4c Mon Sep 17 00:00:00 2001 From: Maxim Mikityanskiy Date: Sun, 9 Aug 2015 13:47:12 +0300 Subject: 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 --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index d7688be0ff..5aa1933859 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -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()) { -- cgit v1.2.3