diff options
Diffstat (limited to 'src/platformsupport/input/libinput')
-rw-r--r-- | src/platformsupport/input/libinput/libinput.pri | 15 | ||||
-rw-r--r-- | src/platformsupport/input/libinput/qlibinputpointer.cpp | 2 | ||||
-rw-r--r-- | src/platformsupport/input/libinput/qlibinputtouch.cpp | 13 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/platformsupport/input/libinput/libinput.pri b/src/platformsupport/input/libinput/libinput.pri index 35d962ff3c..f922769a37 100644 --- a/src/platformsupport/input/libinput/libinput.pri +++ b/src/platformsupport/input/libinput/libinput.pri @@ -10,14 +10,11 @@ SOURCES += \ $$PWD/qlibinputkeyboard.cpp \ $$PWD/qlibinputtouch.cpp -INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV $$QMAKE_INCDIR_LIBINPUT -LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV $$QMAKE_LIBS_LIBINPUT +QMAKE_USE_PRIVATE += libudev libinput -contains(QT_CONFIG, xkbcommon-evdev) { - INCLUDEPATH += $$QMAKE_INCDIR_XKBCOMMON_EVDEV - LIBS_PRIVATE += $$QMAKE_LIBS_XKBCOMMON_EVDEV -} else { - DEFINES += QT_NO_XKBCOMMON_EVDEV -} +INCLUDEPATH += $$PWD/../shared -DEFINES += QT_LIBINPUT_VERSION_MAJOR=$$QMAKE_LIBINPUT_VERSION_MAJOR QT_LIBINPUT_VERSION_MINOR=$$QMAKE_LIBINPUT_VERSION_MINOR +qtConfig(xkbcommon-evdev): \ + QMAKE_USE_PRIVATE += xkbcommon_evdev +else: \ + DEFINES += QT_NO_XKBCOMMON_EVDEV diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp index d5a3a8b437..3b583ec99d 100644 --- a/src/platformsupport/input/libinput/qlibinputpointer.cpp +++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp @@ -96,7 +96,7 @@ 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 +#if QT_LIBRARY_VERSION(libinput) < QT_VERSION_CHECK(0, 8, 0) 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; diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index 0a0e9daccb..42925a18e1 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -41,6 +41,7 @@ #include <libinput.h> #include <QtGui/QGuiApplication> #include <QtGui/QScreen> +#include <QtGui/private/qhighdpiscaling_p.h> QT_BEGIN_NAMESPACE @@ -63,10 +64,14 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e static inline QPointF getPos(libinput_event_touch *e) { - const QSize screenSize = QGuiApplication::primaryScreen()->geometry().size(); - const double x = libinput_event_touch_get_x_transformed(e, screenSize.width()); - const double y = libinput_event_touch_get_y_transformed(e, screenSize.height()); - return QPointF(x, y); + // TODO Map to correct screen using QTouchOutputMapping. + // Perhaps investigate libinput_device_get_output_name as well. + // For now just use the primary screen. + QScreen *screen = QGuiApplication::primaryScreen(); + const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen); + const double x = libinput_event_touch_get_x_transformed(e, geom.width()); + const double y = libinput_event_touch_get_y_transformed(e, geom.height()); + return geom.topLeft() + QPointF(x, y); } void QLibInputTouch::registerDevice(libinput_device *dev) |