-
Notifications
You must be signed in to change notification settings - Fork 1.1k
appkit: improve API interaction with InputMethodKit. #4400
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
base: master
Are you sure you want to change the base?
appkit: improve API interaction with InputMethodKit. #4400
Conversation
|
Unit test logs on my mac: |
kchibisov
left a comment
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 can not comment much whether it'll work or not, so some general comment regarding general code comprehension.
Also, have you able to verify that it actually solves the issue and doesn't affect regular Qwerty input (including hotkey handling) and that output is pretty much the same?
0515c33 to
9017e89
Compare
|
@kchibisov I rebased the commit history of this PR so I can separate the out-of-topic unit test fixes to another PR. Changes against |
9017e89 to
16560cf
Compare
|
I found a new way to test whether ASCII inputs are handled: Test results showing that some extra fixes are needed. I'll push the fix later. |
48f904e to
f03165e
Compare
|
This PR is defibrillated now (see e47d639 ). Everything is green. Tests in this video shows that ASCII inputs and the Sogou-style IMEs (Sogou, WeType (WeChat IME), RIME Squirrel) are all passed with no failure of committing the right punctuations / characters. ScreenRec.2025-11-05.23.44.36.mp4Note: On macOS we must assume that IME has nothing "disabled". This PR uses Ground state for all input methods, incl. macOS built-in ASCII inputs (ABC or EN-US). |
f03165e to
e47d639
Compare
|
I haven't reviewed the code but I've tested these changes. Regular text input works but while the IME is active modifier keys do not work so as is this is still a breaking change. (Tested using dev branch of Floem ui library here.) |
|
@jrmoulton Thanks for your involvement. |
|
@jrmoulton Please also test |
|
It is now working perfectly for me |
- This allows IME devs to identify whether `winit` is used in the IMKTextInput client. If identified, IME devs can introduce compatibility behaviors against such IMKTextInput client. // InputMethodKit casts `NSTextInputClient` to `IMKTextInput`.
- On macOS, route keyDown through `NSTextInputContext::handleEvent` before raw dispatch, suppress stray ASCII from keyUp, and drop stale raw characters when IME commits transformed text (e.g. "." -> "。"), aligning character delivery with Cocoa and third‑party IMEs.
32a0983 to
e5c0945
Compare
|
I hate "merge-commits". I rebased the PR to let them merged before my commits in this PR. Now this PR's HEAD is still the same as what |
|
Can confirm that these changes work for my use cases |
|
@kchibisov I guess my works are all done here unless you found anything I need to amend. |
|
I'd need to test in somehow(don't own macOS) before merging, or @madsmtm can probably take a look. |
This continues the accidentally-closed #4398 , replacing #4396.
cargo +nightly test -p winit-appkitonly.changelogmodule if knowledge of this change could be valuable to userscargo +nightly fmt ; cargo +nightly build ; cargo +nightly run -p winit --example imeThe true reason for the 1st modification in this PR (as listed above) is to allow IME devs to automatically enable their customized popup composition buffer window in lieu of preedit (inline composition buffer). The piggybacked metadata contains the version information of the
winitpackage so IME devs can identify buggywinitreleases in their IMEs and do their individual accomodations. If this metadata is missing or not detected, then IME can use client bundle identifiers instead (which is comparatively more difficult, still.).