-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS: improve IME state management #4087
base: master
Are you sure you want to change the base?
Conversation
fixes rust-windowing#3925 on macOS, when IME is allowed, always send text to IME and use that result when possible. Even if the keyboard is a simple one, like US keyboard. Committed text is now inserted regardless of the presence of a preedit.
I'm unable to test this myself, but it should probably mark #3814 as fixed too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate our IME code with passion (another way of say I don't understand it at all ;) ), and will defer to Kirill's judgement as to whether this is a good idea or not. On the surface it looks fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All regular input now goes though IME, which is wrong. You can see that every character is going through Ime::Commit
and not through regular keyboard input, thus nothing really works anymore when it comes to bindings and key combinations.
Regular input shouldn't go through IME.
Hmmm, then things are much more complicated. How about enable IME only when a text entry is focused? Another way is perhaps to handle all shortcuts in |
What text entry when we have none of that, so it won't really help as you can see? Like the issue is that normal input is not being sent at all. I'd suggest to figure out why punctuation is not sent in the first place, like there's clearly a case with the old code that makes it ignored, which should likely be changed to |
changelog
module if knowledge of this change could be valuable to usersFixes #3925
Fixes #3814
The basic idea of this change is: when IME is allowed, we always forward key events to the IME first, and use the result from the IME. Simpler keyboards, like the US keyboard, is also correctly supported by this.
Summary of changes:
Ime::Enabled
whenset_ime_allowed(true)
. Do not manage it elsewhere. This is a huge simplification, and it should be harmless to current conforming applications.What is improved:
q
(toggles katakana) should work properly. Previously, SKK is not usable at all.(Korean IMEs work mostly fine but #3095 is not fixed by this PR: the first key will generate a call to
insertText:
instead ofsetMarkedText:
, which seems unrelated to the problems this PR tries to fix.)