Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.9.1
-
None
-
qtwayland 6.9.1 on Arch Linux; Wayland compositor is wayfire git or KDE Plasma Version 6.4.2.
Description
Say I have two monitors side-by-side. The wayland scale factors are 1x and 1.6x respectively. I set QT_WAYLAND_FORCE_DPI=120 so that text appears large. (I intentionally make the left monitor 1x and configure clients to scale themselves instead so that programs that do not support fractional scaling still can have shape text on it.)
Now when the window is on the right monitor, the input method window is placed too left: it has a negative x coordinate for the set_cursor_rectangle request.
I've got a patch that fixes this, but I don't quite understand the several coordinates involved:
diff --git a/src/client/qwaylandtextinputv3.cpp b/src/client/qwaylandtextinputv3.cpp
index a9538370..6d7110ac 100644
--- a/src/client/qwaylandtextinputv3.cpp
+++ b/src/client/qwaylandtextinputv3.cpp
@@ -280,7 +280,7 @@ 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 QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QRect &nativeRect = QHighDpi::toNativeLocalPosition(windowRect, QGuiApplication::focusWindow());
const QMargins margins = window->clientSideMargins();
const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
if (surfaceRect != m_cursorRect) {
A sample QML program that can demonstrate the issue:
import QtQuick
import QtQuick.Controls
import QtQuick.WindowWindow {
width: 400
height: 300
visible: true
title: "QML6 TextArea Example" TextArea {
anchors.fill: parent
text: "Type here..."
wrapMode: TextArea.Wrap
{{ }}}
}