Bug 460158 - Incorrect input method (IME) position
Summary: Incorrect input method (IME) position
Status: CLOSED FIXED
Alias: None
Product: ghostwriter
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: megan.conkle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-09 12:17 UTC by Gary Wang
Modified: 2023-12-24 08:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 23.04.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Wang 2022-10-09 12:17:44 UTC
SUMMARY

Ghostwritter seems doesn't have proper input method (IME) support, IME position will always be at the top-left corner of the window.

Tested both under Arch Linux with fcitx5-rime and Windows 11 with it's default Microsoft Chs-IME when Windows system language was set to Chinese.

STEPS TO REPRODUCE

1. Install an IME (Chinese/Japanese/etc.) on your system
2. Open Ghostwriter
3. Type anything with IME enabled

OBSERVED RESULT

IME popped at the top-left side of the window.

EXPECTED RESULT

IME popped at the correct position (normally below the input cursor)

SOFTWARE/OS VERSIONS

Windows: Windows 11 21H2
Linux/KDE Plasma: Arch Linux (rolling)
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION

Linux version get from Arch Linux's official package repo, with ghostwriter 2.1.4-1
Windows version get from GitHub, release 2.1.6

I did a quick glance at the related source code and it seems the MarkdownEditor widget/class didn't handle the QWidget::inputMethodQuery(Qt::InputMethodQuery) query so that's probably the reason...

Feel free to let me know if you need any extra information.
Comment 1 megan.conkle 2022-10-11 06:28:52 UTC
Hi Gary,

I have a question for you.  Which IME application are you using so I can try to replicate this?  A followup question would be:  Is this application for GTK or Qt apps?

Thanks!
Comment 2 Gary Wang 2022-10-11 07:17:34 UTC
Hi again,

> Which IME application are you using so I can try to replicate this?

As already provided in the original report:

When tested under Arch Linux: fcitx5-rime [1]
When tested under Windows 11: default Microsoft Chs-IME when Windows system language was set to Chinese.

[1]: https://archlinux.org/packages/community/x86_64/fcitx5-rime/ in case you need a link.

> A followup question would be:  Is this application for GTK or Qt apps?

It would be generic enough to support both GTK and Qt apps. I did set up some environment variable to make fcitx work under my Arch Linux installation tho. here is the related content in my `/etc/environment` file:

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
Comment 3 megan.conkle 2022-10-12 17:18:13 UTC
(In reply to Gary Wang from comment #2)
> Hi again,
> 
> > Which IME application are you using so I can try to replicate this?
> 
> As already provided in the original report:
> 
> When tested under Arch Linux: fcitx5-rime [1]
> When tested under Windows 11: default Microsoft Chs-IME when Windows system
> language was set to Chinese.
> 
> [1]: https://archlinux.org/packages/community/x86_64/fcitx5-rime/ in case
> you need a link.
> 
> > A followup question would be:  Is this application for GTK or Qt apps?
> 
> It would be generic enough to support both GTK and Qt apps. I did set up
> some environment variable to make fcitx work under my Arch Linux
> installation tho. here is the related content in my `/etc/environment` file:
> 
> GTK_IM_MODULE=fcitx
> QT_IM_MODULE=fcitx
> XMODIFIERS=@im=fcitx

Apologies, my brain burped when reading your original submission on which IME you were using.  :D

I noticed my own distro has fcitx-qt as a package.  Does yours?  It might work better that way.  Unfortunately, neither the vanilla fcitx nor the fcitx-qt apps launch for me on my distro.  :(  I'll have to spend more time to get it working.  But in the meantime, if you could try with the Qt version of fcitx, that would be of great help!
Comment 4 Bug Janitor Service 2022-10-27 05:05:08 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Gary Wang 2022-10-28 01:25:08 UTC
> I noticed my own distro has fcitx-qt as a package.  Does yours? It might work better that way.

We does have fcitx(5)-qt under Arch Linux, but fcitx is a IME framework, and fcitx(5)-qt is a IME module, it doesn't means there will be better Qt support.

btw, *any* IME should be able to reproduce this issue, for example ibus can be used to reproduce issue too if you can't get fcitx working. Or you can also use Windows to reproduce this issue with any IME installed and enabled while typing words, e.g. https://www.google.co.jp/ime/

> But in the meantime, if you could try with the Qt version of fcitx, that would be of great help!

I don't think it will be fixed unless we add QWidget::inputMethodQuery(Qt::InputMethodQuery) support to the app to tell IME where to show the IME window...
Comment 6 megan.conkle 2022-10-29 22:38:11 UTC
Git commit 8649c3e4ad5d07e24cee13b28d22566909fddda8 by Megan Conkle.
Committed on 29/10/2022 at 22:32.
Pushed by wereturtle into branch 'master'.

Fix IME window displacement

Implement inputMethodQuery() method to return the correct cursor
rectangle for displaying the IME window.

M  +38   -4    src/markdowneditor.cpp
M  +15   -0    src/markdowneditor.h

https://invent.kde.org/office/ghostwriter/commit/8649c3e4ad5d07e24cee13b28d22566909fddda8
Comment 7 megan.conkle 2022-10-29 22:39:33 UTC
(In reply to Gary Wang from comment #5)
> I don't think it will be fixed unless we add
> QWidget::inputMethodQuery(Qt::InputMethodQuery) support to the app to tell
> IME where to show the IME window...

Thanks for that tip.  That helped!