summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-01-28 13:06:37 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-02-02 14:03:43 +0000
commitd2be83bc279cc35911f10fe5fb056a4d8f80bb5b (patch)
tree53e7e91a3c57e26f8cffc58bda0475ed593881a0 /src/platformsupport/input
parentaa475a30af2e6905acee5e0e4260414ac493b0e3 (diff)
Update for libinput 0.8
We don't yet have API compatibility, apparently, so we need to keep up with those changes. Dropping support for older versions is not yet acceptable since some distros (in particular current version of some embedded ones) may ship these versions. Change-Id: Ibea780abd76c4b89661012dfea46868b432ded42 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/platformsupport/input')
-rw-r--r--src/platformsupport/input/libinput/libinput.pri2
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/platformsupport/input/libinput/libinput.pri b/src/platformsupport/input/libinput/libinput.pri
index bed9e79738..35d962ff3c 100644
--- a/src/platformsupport/input/libinput/libinput.pri
+++ b/src/platformsupport/input/libinput/libinput.pri
@@ -19,3 +19,5 @@ contains(QT_CONFIG, xkbcommon-evdev) {
} else {
DEFINES += QT_NO_XKBCOMMON_EVDEV
}
+
+DEFINES += QT_LIBINPUT_VERSION_MAJOR=$$QMAKE_LIBINPUT_VERSION_MAJOR QT_LIBINPUT_VERSION_MINOR=$$QMAKE_LIBINPUT_VERSION_MINOR
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index 28e5529b3c..9dd4c0698a 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -91,11 +91,21 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
void QLibInputPointer::processAxis(libinput_event_pointer *e)
{
+#if QT_LIBINPUT_VERSION_MAJOR == 0 && QT_LIBINPUT_VERSION_MINOR <= 7
const double v = libinput_event_pointer_get_axis_value(e) * 120;
const Qt::Orientation ori = libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL
? Qt::Vertical : Qt::Horizontal;
-
QWindowSystemInterface::handleWheelEvent(Q_NULLPTR, m_pos, m_pos, qRound(-v), ori, QGuiApplication::keyboardModifiers());
+#else
+ if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
+ const double v = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL) * 120;
+ QWindowSystemInterface::handleWheelEvent(Q_NULLPTR, m_pos, m_pos, qRound(-v), Qt::Vertical, QGuiApplication::keyboardModifiers());
+ }
+ if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
+ const double v = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL) * 120;
+ QWindowSystemInterface::handleWheelEvent(Q_NULLPTR, m_pos, m_pos, qRound(-v), Qt::Horizontal, QGuiApplication::keyboardModifiers());
+ }
+#endif
}
QT_END_NAMESPACE