Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ksqsf
Copy link

@ksqsf ksqsf commented Jan 21, 2025

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

Fixes #3925

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:

  • Send Ime::Enabled when set_ime_allowed(true). Do not manage it elsewhere. This is a huge simplification, and it should be harmless to current conforming applications.
  • Do not prevent inserting text when there's no preedit.
  • Do not try to forward key to app even when no text is committed. This is safe because the IME now receive all keys and forwards back unhandled keys.
  • Some code becomes useless after the change and is thus removed.

What is improved:

  1. Any Chinese or Japanese input methods should now commit full-width punctuation just fine. Previously, this never worked.
  2. SKK Japanese IME should work now. Also, the toggle key q (toggles katakana) should work properly. Previously, SKK is not usable at all.
  3. The behavior of Korean IMEs doesn't change.

(Korean IMEs work mostly fine but #3095 is not fixed by this PR: the first key will generate a call to insertText: instead of setMarkedText:, which seems unrelated to the problems this PR tries to fix.)

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.
@ksqsf ksqsf requested a review from madsmtm as a code owner January 21, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

incorrectly handle insertText (macOS)
1 participant