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>
This commit is contained in:
Laszlo Agocs 2015-01-28 13:06:37 +01:00
parent aa475a30af
commit d2be83bc27
3 changed files with 17 additions and 1 deletions

4
configure vendored
View File

@ -5166,6 +5166,10 @@ if [ "$CFG_LIBINPUT" != "no" ] && [ "$CFG_LIBUDEV" != "no" ]; then
QMAKE_INCDIR_LIBINPUT=`$PKG_CONFIG --cflags-only-I libinput 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
QMAKE_LIBS_LIBINPUT=`$PKG_CONFIG --libs libinput 2>/dev/null`
QMAKE_CFLAGS_LIBINPUT=`$PKG_CONFIG --cflags libinput 2>/dev/null`
QMAKE_LIBINPUT_VERSION_MAJOR=`$PKG_CONFIG --modversion libinput 2>/dev/null | cut -d . -f 1`
QMAKE_LIBINPUT_VERSION_MINOR=`$PKG_CONFIG --modversion libinput 2>/dev/null | cut -d . -f 2`
QMakeVar set QMAKE_LIBINPUT_VERSION_MAJOR "$QMAKE_LIBINPUT_VERSION_MAJOR"
QMakeVar set QMAKE_LIBINPUT_VERSION_MINOR "$QMAKE_LIBINPUT_VERSION_MINOR"
QMakeVar set QMAKE_INCDIR_LIBINPUT "$QMAKE_INCDIR_LIBINPUT"
QMakeVar set QMAKE_LIBS_LIBINPUT "$QMAKE_LIBS_LIBINPUT"
fi

View File

@ -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

View File

@ -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