diff options
author | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-11-05 13:34:36 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-11-18 14:11:41 +0000 |
commit | 6f8a19846ba51966f524a7b9eb2c4a2b118f4b47 (patch) | |
tree | dbf87bc7e3528f7afbf953dac2052c39dcc37a63 /src/platformsupport/input/libinput | |
parent | 3510c7324d34eb4c67fa6c8fdf0507e87eb1d25e (diff) |
Input: Convert QScreen geometry to native pixels
Low-level input handling uses the native coordinate
system and the (device independent) coordinates from
QScreen needs to be converted.
Change-Id: I501dc77f5e51be01a42e533cd0609e069b8d228b
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/platformsupport/input/libinput')
-rw-r--r-- | src/platformsupport/input/libinput/qlibinputpointer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp index 48e5a6cf1c..55339a841a 100644 --- a/src/platformsupport/input/libinput/qlibinputpointer.cpp +++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp @@ -36,6 +36,7 @@ #include <QtGui/QGuiApplication> #include <QtGui/QScreen> #include <qpa/qwindowsysteminterface.h> +#include <private/qhighdpiscaling_p.h> QT_BEGIN_NAMESPACE @@ -81,7 +82,8 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e) { const double dx = libinput_event_pointer_get_dx(e); const double dy = libinput_event_pointer_get_dy(e); - const QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); + QScreen * const primaryScreen = QGuiApplication::primaryScreen(); + const QRect g = QHighDpi::toNativePixels(primaryScreen->virtualGeometry(), primaryScreen); m_pos.setX(qBound(g.left(), qRound(m_pos.x() + dx), g.right())); m_pos.setY(qBound(g.top(), qRound(m_pos.y() + dy), g.bottom())); @@ -110,7 +112,9 @@ void QLibInputPointer::processAxis(libinput_event_pointer *e) void QLibInputPointer::setPos(const QPoint &pos) { - const QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); + QScreen * const primaryScreen = QGuiApplication::primaryScreen(); + const QRect g = QHighDpi::toNativePixels(primaryScreen->virtualGeometry(), primaryScreen); + m_pos.setX(qBound(g.left(), pos.x(), g.right())); m_pos.setY(qBound(g.top(), pos.y(), g.bottom())); } |