diff --git a/krfb/framebuffer.cpp b/krfb/framebuffer.cpp index ac990557..32719f23 100644 --- a/krfb/framebuffer.cpp +++ b/krfb/framebuffer.cpp @@ -8,6 +8,8 @@ #include #include +#include +#include FrameBuffer::FrameBuffer(QObject *parent) @@ -72,5 +74,14 @@ void FrameBuffer::stopMonitor() QPoint FrameBuffer::cursorPosition() { - return QCursor::pos(); + QPoint cursorPos = QCursor::pos(); + QScreen *primaryScreen = QGuiApplication::primaryScreen(); + if (primaryScreen) { + qreal scaleFactor = primaryScreen->devicePixelRatio(); + cursorPos.setX(qRound(cursorPos.x() * scaleFactor)); + cursorPos.setY(qRound(cursorPos.y() * scaleFactor)); + } else { + qWarning() << "cursorPosition: ERROR: Failed to get application's primary screen info!"; + } + return cursorPos; }