summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/qwaylandtextinputv1.cpp6
-rw-r--r--src/client/qwaylandtextinputv2.cpp6
-rw-r--r--src/client/qwaylandtextinputv3.cpp6
3 files changed, 12 insertions, 6 deletions
diff --git a/src/client/qwaylandtextinputv1.cpp b/src/client/qwaylandtextinputv1.cpp
index da8bbae71..3b45322b1 100644
--- a/src/client/qwaylandtextinputv1.cpp
+++ b/src/client/qwaylandtextinputv1.cpp
@@ -10,6 +10,7 @@
#include <QtCore/qloggingcategory.h>
#include <QtGui/QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtGui/qevent.h>
#include <QtGui/qwindow.h>
@@ -127,8 +128,9 @@ void QWaylandTextInputv1::updateState(Qt::InputMethodQueries queries, uint32_t f
if (queries & Qt::ImCursorRectangle) {
const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
- const QMargins margins = window->frameMargins();
- const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top());
+ const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QMargins margins = window->clientSideMargins();
+ const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
}
diff --git a/src/client/qwaylandtextinputv2.cpp b/src/client/qwaylandtextinputv2.cpp
index 89a8a6d77..9d462f7d6 100644
--- a/src/client/qwaylandtextinputv2.cpp
+++ b/src/client/qwaylandtextinputv2.cpp
@@ -11,6 +11,7 @@
#include <QtCore/qloggingcategory.h>
#include <QtGui/QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtGui/qevent.h>
#include <QtGui/qwindow.h>
@@ -134,8 +135,9 @@ void QWaylandTextInputv2::updateState(Qt::InputMethodQueries queries, uint32_t f
if (queries & Qt::ImCursorRectangle) {
const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
- const QMargins margins = window->frameMargins();
- const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top());
+ const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QMargins margins = window->clientSideMargins();
+ const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
}
diff --git a/src/client/qwaylandtextinputv3.cpp b/src/client/qwaylandtextinputv3.cpp
index ad43ff1bc..4344667a2 100644
--- a/src/client/qwaylandtextinputv3.cpp
+++ b/src/client/qwaylandtextinputv3.cpp
@@ -8,6 +8,7 @@
#include <QtCore/qloggingcategory.h>
#include <QtGui/qguiapplication.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/qevent.h>
#include <QtGui/qwindow.h>
#include <QTextCharFormat>
@@ -236,8 +237,9 @@ void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t f
if (queries & Qt::ImCursorRectangle) {
const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
- const QMargins margins = window->frameMargins();
- const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top());
+ const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QMargins margins = window->clientSideMargins();
+ const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
if (surfaceRect != m_cursorRect) {
set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
m_cursorRect = surfaceRect;