Bug 395598 - Cannot use CJK input method in input boxes on popup UI elements.
Summary: Cannot use CJK input method in input boxes on popup UI elements.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: git master (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-19 07:21 UTC by Tyson Tan
Modified: 2021-06-09 07:55 UTC (History)
3 users (show)

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


Attachments
New tag box location (91.74 KB, image/png)
2018-06-19 07:21 UTC, Tyson Tan
Details
Input method at work in Brush Preset Docker's Search box (62.10 KB, image/png)
2018-06-19 07:39 UTC, Tyson Tan
Details
[Windows Only] Cannot switch CJK input method in Rename Brush Preset input box (126.08 KB, image/png)
2018-06-21 03:19 UTC, Tyson Tan
Details
[Windows Only] Cannot switch CJK input method in Text Brush Tip's Text input box (116.20 KB, image/png)
2018-06-21 03:20 UTC, Tyson Tan
Details
The popup location where input method doesn't work (62.91 KB, image/png)
2021-05-31 03:38 UTC, Tyson Tan
Details
F5/F6 panel search box cannot switch input method after popup box switched (451.35 KB, image/png)
2021-06-01 17:01 UTC, Tyson Tan
Details
Krita 5.0 Layer Filter input box (14.82 KB, image/png)
2021-06-08 03:58 UTC, Tyson Tan
Details
Krita 5.0 Popup shortcut list inpux box (97.41 KB, image/png)
2021-06-08 03:59 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2018-06-19 07:21:07 UTC
Created attachment 113419 [details]
New tag box location

Premise: 

Chinese, Japanese and Korean have way too many letters. Unlike western languages which can be input directly from a keyboard, CJK languages are typically input using a helper application that translates latin-formatted pronunciation into actual letters: INPUT [HUI HUA] >> OUTPUT [绘画] (Chinese word for drawing).

On Linux, we call these helpers "Input sources", and we generally have two choices for Input Source Framework: ibus (GNOME) or fcitx (KDE) and scim. These are the base services for loading different input schemes like: ibus-libpinyin, fcitx-libpinyin. On Windows, these are handled as the Input Methods (IMEs). 

The Bug itself:
CJK input method cannot be used in Brush Preset Docker's New tag input box. It can be used in the docker's Search box, but not in the right-click menu's "New tag" box.

When the cursor is in the Search box, I can trigger input method with Shift/Super+Space. But for some reason, I can neither trigger them in the "new tag" box. Even when I enter the new tag box with my input method turned-on, it can only input English.

This bug happens on both Linux and Windows, and the symptoms are 100% identical. I suspect it to be a deficiency from Qt.

Workaround:

Copy and paste existing CJK letters directly into "New tag" box.
Comment 1 Halla Rempt 2018-06-19 07:26:45 UTC
Maybe that's because this is in a popup, and the input thing is also a popup?
Comment 2 Tyson Tan 2018-06-19 07:39:19 UTC
Created attachment 113420 [details]
Input method at work in Brush Preset Docker's Search box

Yeah, I think an input method can be counted as a on-canvas "popup".
Comment 3 Tyson Tan 2018-06-21 03:19:55 UTC
Created attachment 113476 [details]
[Windows Only] Cannot switch CJK input method in Rename Brush Preset input box
Comment 4 Tyson Tan 2018-06-21 03:20:58 UTC
Created attachment 113477 [details]
[Windows Only] Cannot switch CJK input method in Text Brush Tip's Text input box
Comment 5 Eike Hein 2018-06-21 10:38:40 UTC
I have an automatic daily Bugzilla search set up for "Korean" because I tend to work on text input issues across KDE (I live in Seoul and type Korean frequently).

I am super busy currently, but I'll try to take a look at this soon.
Comment 6 Eike Hein 2018-06-21 10:39:17 UTC
Oh wait, this is Windows-specific? Then I might not be able to help, I only know Linux well :(.
Comment 7 Tyson Tan 2018-06-21 14:03:44 UTC
(In reply to Eike Hein from comment #6)
> Oh wait, this is Windows-specific? Then I might not be able to help, I only
> know Linux well :(.

Yes you can help, they are NOT exactly Windows specific.

This one is Linux / Windows shared:
https://bugs.kde.org/attachment.cgi?id=113419

Although tagged as Windows only, both Linux/Windows cannot switch input method in these boxes, although on Linux, I can switch to an input method before opening the popup and I can use it, while on Windows I cannot:
https://bugs.kde.org/attachment.cgi?id=113476
https://bugs.kde.org/attachment.cgi?id=113477

I suspect a Qt issue here.
Comment 8 Halla Rempt 2018-10-09 13:32:04 UTC
Maybe this is a duplicate https://bugs.kde.org/show_bug.cgi?id=395745 ?
Comment 9 Tyson Tan 2018-10-15 01:49:02 UTC
(In reply to Boudewijn Rempt from comment #8)
> Maybe this is a duplicate https://bugs.kde.org/show_bug.cgi?id=395745 ?

Probably not. I cannot recreate the same situation with either Linux's or Windows's Chinese input source. I guess it was that bug is specific to a Korean input source.
Comment 10 Tyson Tan 2018-10-15 02:02:44 UTC
Re-tested and Summary:

------------

### Linux

# Brush Preset Search box
[Y] Input source can be switched
[Y] Input source can be used

# New Tag box
[N] Input source can be switched
[Y] Input source can be used

------------

### Windows

# Brush Preset Search box
[Y] Input source can be switched
[Y] Input source can be used

# New Tag box
[N] Input source can be switched
[N] Input source can be used

------------

### NOTES

# Input source is toggled by: [Super] + [Space]

# Input source's EN only mode is toggled by: [Shift]

# Input source intercepts all keyboard inputs, but only in *SOME* input fields where it considers to be text input. For example, it doesn't work in password field.

# My guess:

It's either OS/DE or Krita is suppressing [Super] and [Shift] in some case;
Or
It's the input field of New Tag box not being recognized by Input Sources correctly.
Comment 11 Halla Rempt 2021-03-25 14:40:15 UTC
Windragon just checked this, and it's still an issue -- and I still don't know what to do other than to change the tagging menu into a tagging dialog. That should do the trick...
Comment 12 Alvin Wong 2021-05-29 12:43:03 UTC
Git commit 30754f5f40e2e6711a639a920fe62c8d4a2b2646 by Alvin Wong.
Committed on 29/05/2021 at 12:41.
Pushed by alvinwong into branch 'master'.

Fix input method not working on popup widgets

M  +1    -0    libs/widgetutils/KisPopupButton.cpp

https://invent.kde.org/graphics/krita/commit/30754f5f40e2e6711a639a920fe62c8d4a2b2646
Comment 13 Alvin Wong 2021-05-29 12:45:18 UTC
@Tyson I think this commit fixes the issue, at least for me on Windows, without any adverse effects. Can you give it a test on both Windows and Linux with your input methods when it gets included in the upcoming nightly build?
Comment 14 Tyson Tan 2021-05-29 18:31:24 UTC
(In reply to Alvin Wong from comment #13)
> @Tyson I think this commit fixes the issue, at least for me on Windows,
> without any adverse effects. Can you give it a test on both Windows and
> Linux with your input methods when it gets included in the upcoming nightly
> build?

Thanks Alvin for solving this huge issue for CJK users. I will test it as soon as it's in the nightly and provide my feedback here.
Comment 15 Tyson Tan 2021-05-31 03:33:55 UTC
Hi Alvin, I have tested both the Windows and Linux Nightlies:
krita-nightly-x64-5.0.0-prealpha-30754f5f40-setup.exe
krita-5.0.0-prealpha-30754f5-x86_64.appimage	

But unfortunately, neither of them worked for me. I will mark this as reopened.
Comment 16 Tyson Tan 2021-05-31 03:38:07 UTC
Created attachment 138887 [details]
The popup location where input method doesn't work

To make sure we were on the same page, here is the screenshot of the popup location related to this bug.
Comment 17 Tyson Tan 2021-05-31 03:43:02 UTC
I used fcitx under Linux, and Windows 10 (20H2/21H1)'s system input method (not 3rd party) during the testing. I could use them in all other Krita input boxes except the tag popup. When the cursor was focused on that popup with Input Method already enabled, it will immediately cease to keep its state and fallback to System Base Keyboard (English).
Comment 18 Alvin Wong 2021-05-31 07:17:55 UTC
True, there are more popups with this behaviour. Maybe I should look into fixing it properly from within Qt instead?...

I can try applying the same fix from Krita for them. Did you notice any more popups with this issue?
Comment 19 Tyson Tan 2021-05-31 07:32:40 UTC
So far the popup in Comment 16 is the only one I know that still not working.

You have fixed every other similar input boxes that I know of (if they were broken).

Sorry I have only checked that one because it was why I reported this bug. I totally forgot we have other popups like this.
Comment 20 Alvin Wong 2021-05-31 18:04:17 UTC
Git commit 8717078e17f9d3269103e6b37f31fb9689305fdd by Alvin Wong.
Committed on 31/05/2021 at 18:03.
Pushed by alvinwong into branch 'master'.

Fix input method not working on new tag box

M  +24   -1    libs/resourcewidgets/TagActions.cpp

https://invent.kde.org/graphics/krita/commit/8717078e17f9d3269103e6b37f31fb9689305fdd
Comment 21 Alvin Wong 2021-05-31 18:05:13 UTC
Please let me know if it doesn't work, or if you find more popups with the same issue.
Comment 22 Alvin Wong 2021-06-01 16:13:37 UTC
Git commit 94b6cbda3de3ad55cbf52230406545a505025308 by Alvin Wong.
Committed on 01/06/2021 at 15:56.
Pushed by alvinwong into branch 'krita/4.3'.

Fix input method not working on popup widgets
(cherry picked from commit 30754f5f40e2e6711a639a920fe62c8d4a2b2646)

M  +1    -0    libs/widgets/kis_popup_button.cc

https://invent.kde.org/graphics/krita/commit/94b6cbda3de3ad55cbf52230406545a505025308
Comment 23 Alvin Wong 2021-06-01 16:13:45 UTC
Git commit 53cd440f20d54909e3163982ea79a66e6364ec64 by Alvin Wong.
Committed on 01/06/2021 at 16:13.
Pushed by alvinwong into branch 'krita/4.3'.

Fix input method not working on new tag box
(cherry picked from commit 8717078e17f9d3269103e6b37f31fb9689305fdd)

M  +24   -1    libs/widgets/KoResourceItemChooserContextMenu.cpp

https://invent.kde.org/graphics/krita/commit/53cd440f20d54909e3163982ea79a66e6364ec64
Comment 24 Tyson Tan 2021-06-01 17:01:02 UTC
Created attachment 138924 [details]
F5/F6 panel search box cannot switch input method after popup box switched

Hi Alvin,
Thank you for the last fix! Now the popups can switch input method.

However, with that fix a new glitch has occurred:
In F5/F6 panels, if I switched input method in a popup first, then I won't be able to switch input method in the search box. This issue doesn't affect Docker panels. The Docker panel's popup and search box remember their input method states individually.

Workaround:
Close and reopen the F5/F6 panel.
Comment 25 Alvin Wong 2021-06-02 06:10:29 UTC
(In reply to Tyson Tan from comment #24)
> However, with that fix a new glitch has occurred:
> In F5/F6 panels, if I switched input method in a popup first, then I won't
> be able to switch input method in the search box. This issue doesn't affect
> Docker panels. The Docker panel's popup and search box remember their input
> method states individually.

I think this might be specific to Linux (or even specific DEs) because I can't seem to reproduce this on Windows. I can try fixing this later on master, but it will not be in the next 4.4 release.
Comment 26 Tyson Tan 2021-06-02 08:48:58 UTC
(In reply to Alvin Wong from comment #25)
> I think this might be specific to Linux (or even specific DEs) because I
> can't seem to reproduce this on Windows. I can try fixing this later on
> master, but it will not be in the next 4.4 release.

No problem, Krita 4.4 doesn't support non-latin1 characters for tags anyway -- they disappear upon restarting Krita.

And I was unable to reproduce the last glitch on Windows either. As long as the Windows version works, this doesn't need to be a priority.

The Android version could be affected though. So it would be nice if we can get to the bottom of this before Krita 5.0 is out.
Comment 27 Alvin Wong 2021-06-07 09:35:46 UTC
Sorry, I can't think of a reasonable method to fix the last issue without potentially breaking other things. I guess users will have to reopen the popup to fix it.

I also tried to test it on Android, but my test system does not have a functional input method that supports a physical keyboard. It works with the on-screen keyboard though.

It looks like the inability to use input methods in popups is "by design" (see [1]), so I suppose it is accidental that my workaround even works at all.

[1]: https://bugreports.qt.io/browse/QTBUG-83490
Comment 28 Tyson Tan 2021-06-07 09:54:33 UTC
(In reply to Alvin Wong from comment #27)
> Sorry, I can't think of a reasonable method to fix the last issue without
> potentially breaking other things. I guess users will have to reopen the
> popup to fix it.
> 
> I also tried to test it on Android, but my test system does not have a
> functional input method that supports a physical keyboard. It works with the
> on-screen keyboard though.
> 
> It looks like the inability to use input methods in popups is "by design"
> (see [1]), so I suppose it is accidental that my workaround even works at
> all.
> 
> [1]: https://bugreports.qt.io/browse/QTBUG-83490

No problem. It's not news to me that the limitations from libraries or even computer languages can make certain features unfeasible or impractical. CJK Input methods themselves are already a hack of some sort.

At least you made it work for Windows and Android, and the glitch under Linux has easy and natural workaround.

Thank you again for your effort! :D
Comment 29 Tyson Tan 2021-06-08 03:58:30 UTC
Created attachment 139096 [details]
Krita 5.0 Layer Filter input box

Krita 5.0 Layer Filter input box cannot use input method. Windows only.
Comment 30 Tyson Tan 2021-06-08 03:59:51 UTC
Created attachment 139097 [details]
Krita 5.0 Popup shortcut list  inpux box

Krita 5.0 Popup Shortcut List (Ctrl+Enter) input box cannot use input method. Windows only.
Comment 31 Tyson Tan 2021-06-08 04:02:43 UTC
The local community reported two more location where input method cannot be used. They affect only the Windows version. See Comment 29 and Comment 30 for screenshots.

I'm using Linux so I wasn't able to find them last time, sorry.
Comment 32 Alvin Wong 2021-06-08 08:17:49 UTC
For the second new issue I opened bug 438122 because that needs another approach at fixing.
Comment 33 Alvin Wong 2021-06-08 13:42:45 UTC
Git commit ac9145a2b208f286458786c9aa4d12f94de507c9 by Alvin Wong.
Committed on 08/06/2021 at 13:40.
Pushed by alvinwong into branch 'master'.

Use KisPopupSelfActivatingLineEdit for layer filter

M  +2    -1    libs/ui/widgets/kis_layer_filter_widget.cpp

https://invent.kde.org/graphics/krita/commit/ac9145a2b208f286458786c9aa4d12f94de507c9
Comment 34 Alvin Wong 2021-06-09 07:16:19 UTC
Git commit c61db8c268b04181462033eace0b4bf2a7e71b1b by Alvin Wong.
Committed on 09/06/2021 at 07:16.
Pushed by alvinwong into branch 'master'.

Fix using input method in command bar
Related: bug 438122

M  +12   -1    libs/ui/KisMainWindow.cpp

https://invent.kde.org/graphics/krita/commit/c61db8c268b04181462033eace0b4bf2a7e71b1b
Comment 35 Tyson Tan 2021-06-09 07:55:45 UTC
Thank you again, Alvin! :D