For regular Qt application, the ImCursorRectangle value returned by inputMethodQuery is scaled with the corresponding QWindow's device scale factor. But libreoffice returns the non-scaled value which confuses the input method and send the non-native coordinates. To be more concrete, this is how the coordinates being transformed by fcitx: (fcitx is expected to receive the native pixel value from application) https://github.com/fcitx/fcitx5-qt/blob/cb48a057e1bcb0961a9eaaf12dda73f164b98b0c/qt5/platforminputcontext/qfcitxplatforminputcontext.cpp#L413 As you can see, the coordinates is up-scaled based on the input window's device pixel ratio then sent to input method server. But libreoffice set the non-scale value here, which makes it scaled wrongly in this code. In this case, Libreoffice need to be fixed to behave consistently with other Qt application on this value (dividing the value by window scale).
(In reply to Xuetian Weng from comment #0) > For regular Qt application, the ImCursorRectangle value returned by > inputMethodQuery is scaled with the corresponding QWindow's device scale > factor. > > But libreoffice returns the non-scaled value which confuses the input method > and send the non-native coordinates. > > To be more concrete, this is how the coordinates being transformed by fcitx: > (fcitx is expected to receive the native pixel value from application) > > https://github.com/fcitx/fcitx5-qt/blob/ > cb48a057e1bcb0961a9eaaf12dda73f164b98b0c/qt5/platforminputcontext/ > qfcitxplatforminputcontext.cpp#L413 > > As you can see, the coordinates is up-scaled based on the input window's > device pixel ratio then sent to input method server. But libreoffice set the > non-scale value here, which makes it scaled wrongly in this code. Thanks for your report and explanation on what's happening. Can you give specific steps on how one can reproduce that something behaves in a wrong way (description of steps to take, expected vs. actual behaviour)? In case you already know how to fix the issue: We're happy to review and accept patches. :-) https://wiki.documentfoundation.org/Development/GetInvolved
There is now https://gerrit.libreoffice.org/c/core/+/110945 I first tried to do some mapToParent stuff from the linked fcitx code. But actually we literally just need to "dividing the value by window scale". Easy to reproduce, if you have a complex input, like Pinyin and start LO with QT_SCALE_FACTOR=1.5, activate IM and the input methods window is positioned wrong. Also the terminology with "native" pixels caught me wrong :-)
Jan-Marek Glogowski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/41cffc379259fec626a282ca243a9750d96d1c63 tdf#140207 Qt downscale the ExtTextInputPos It will be available in 7.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jan-Marek Glogowski committed a patch related to this issue. It has been pushed to "libreoffice-7-1": https://git.libreoffice.org/core/commit/61bf6b4d90aa1d37009b397e44fe39c9c5b06afd tdf#140207 Qt downscale the ExtTextInputPos It will be available in 7.1.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jan-Marek Glogowski committed a patch related to this issue. It has been pushed to "libreoffice-7-0": https://git.libreoffice.org/core/commit/cb566a1806563f779690d79479ad5ba1ccef0460 tdf#140207 Qt downscale the ExtTextInputPos It will be available in 7.0.5. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.