diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index c4ebc5c51d..76d8aab8f2 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -43,6 +43,7 @@ #include #include // overrides QT_OPEN +#include #include @@ -141,7 +142,8 @@ bool QEvdevMouseHandler::getHardwareMaximum() m_hardwareHeight = absInfo.maximum - absInfo.minimum; - QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); + QScreen *primaryScreen = QGuiApplication::primaryScreen(); + QRect g = QHighDpi::toNativePixels(primaryScreen->virtualGeometry(), primaryScreen); m_hardwareScalerX = static_cast(m_hardwareWidth) / (g.right() - g.left()); m_hardwareScalerY = static_cast(m_hardwareHeight) / (g.bottom() - g.top()); diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index 805397f021..68db0b26ba 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -41,6 +41,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -106,7 +107,8 @@ QEvdevMouseManager::~QEvdevMouseManager() void QEvdevMouseManager::clampPosition() { // clamp to screen geometry - QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); + QScreen *primaryScreen = QGuiApplication::primaryScreen(); + QRect g = QHighDpi::toNativePixels(primaryScreen->virtualGeometry(), primaryScreen); if (m_x + m_xoffset < g.left()) m_x = g.left() - m_xoffset; else if (m_x + m_xoffset > g.right()) 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 #include #include +#include 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())); }