summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/libinput/qlibinputpointer.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-14 11:36:32 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-09-18 15:39:07 +0000
commit53d1e26ff553b9eda5041929101c0ed054fc775b (patch)
tree14cb9e207bb6b04ab95af354f00fc8dfb290eed9 /src/platformsupport/input/libinput/qlibinputpointer.cpp
parente7db28fa9ddb6cf165cf239836f3ee50913cd3d3 (diff)
High resolution wheel-event support from libinput
Is necessary because the support was added using a new event and a new getter. [ChangeLog][QtGui][libinput] Can now use the hires scrolling API from libinput 1.19, adding this feature to QPAs using libinput directly Task-number: QTBUG-96227 Change-Id: Ie30281de2f6391389e9e6049bc4117d3a8f63ad1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/platformsupport/input/libinput/qlibinputpointer.cpp')
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index db9e81b5df..bf26075f7c 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -133,16 +133,28 @@ void QLibInputPointer::processAxis(libinput_event_pointer *e)
angleDelta.setX(qRound(value));
#else
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
+#if QT_CONFIG(libinput_hires_wheel_support)
+ value = libinput_event_pointer_get_scroll_value_v120(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+#else
value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+#endif
angleDelta.setY(qRound(value));
}
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
+#if QT_CONFIG(libinput_hires_wheel_support)
+ value = libinput_event_pointer_get_scroll_value_v120(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+#else
value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+#endif
angleDelta.setX(qRound(value));
}
#endif
- const int factor = 8;
- angleDelta *= -factor;
+#if QT_CONFIG(libinput_hires_wheel_support)
+ const int factor = -1;
+#else
+ const int factor = -8;
+#endif
+ angleDelta *= factor;
Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, QPoint(), angleDelta, mods);
}