-
Notifications
You must be signed in to change notification settings - Fork 1.2k
appkit: let valid_attributes_for_marked_text report winit metadata.
#4398
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
appkit: let valid_attributes_for_marked_text report winit metadata.
#4398
Conversation
6736710 to
3cbe8f3
Compare
|
Seems that there are some compatibility issues with the latest CI environment. Lemme draft this PR until the compilation issue gets solved. |
Can't winit just detect such cases? Like the issue with certain patches is that they route pretty much everything straight into the |
- 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`.
3cbe8f3 to
094eff9
Compare
|
Compilation issue with latest rust CI has been solved. |
I simply just do not want to participate any discussion related to certain |
|
Well, if you decided to not communicate with me, then I'm not sure how to proceed with even reviewing things like that or merging them. If you want to just put code for observation then it's fine, I guess. I'm not even sure what was wrong with such a question, like I wanted to avoid having workarounds in IMEs. If such questions offend you, then, well... |
|
@kchibisov You did not offend me at all. I'm sorry for letting you feel confused. The
I mean punctuations like |
|
@kchibisov By the way, |
Given that I'm also part of said repository, I'd say that while AI agent rule isn't written, but due to general tendency of people spamming with it, such reply could be given. In general, you should have been discussed not there but rather here, and even then, the larger the comment the less likely it'll be read fully. |
And what I try to understand here, is whether those patterns are detectable, since I feel like they could be detectable on winit side of things and we can route them properly? Like consider this #4374 What I think is that if you try to compare |
Different IME devs may prefer different keycode-character mappings. Some of these IMEs even allow users to customize such mappings.
My deduction: Maybe both Sogou IME and WeChat Input share some same method of using IMK-related handling APIs other than (It's about time for me to try RIME Squirrel using some Sogou-style Pinyin Schema to see whether the issue is repeatable. At least, RIME is open-source). |
But does it really matter if we compare text for I'm expecting that for e.g. Qwerty, they'll match, but for said IMEs they won't and in such cases we can just a) Send it via IMEs doing something strange and no way to report bugs will just take time and energy, but testing my suggestion might be faster. I don't have macOS so try to delegate, but it's fine if you don't want to. |
|
Short answers:
Rather than string-comparing KeyDown text vs insertText, I'd suggest following Cocoa's contract: if If that boolean isn't reliable in our glue, a practical fallback is to coalesce within the same runloop turn: when an insertText/Commit arrives for the same keypress, prefer it and drop the raw ReceivedCharacter (especially when they differ). This aligns with NSTextView behavior and avoids brittle comparisons. Why this matters: with Sogou/WeChat punctuation we frequently see '.' (ReceivedCharacter) vs '。' (Commit). If we don't suppress the raw character, '.' wins and users can't input the intended punctuation. |
|
In general, I think both should work, it's just, in the way it was send in #4374 I think pretty much all the text will go into
But that is covered by what I've proposed, isn't it? If they differ, we suppress regular |
|
Thanks for the follow-up. Regarding Instead of relying on scancode, here's a more targeted approach:
Why This Works:
This addresses the punctuation mismatch while keeping IME semantics intact. |
|
It seems like winit/winit-x11/src/event_processor.rs Line 152 in a9c189a
So basically the logic would be pretty much the same? |
|
Thanks for your response. I have no knowledge against X11. However, intel from Codex suggests that the mental model matches X11:
|
|
@kchibisov I amend my initial responses regarding the IMEs affected: I just tested that the RIME Squirrel (the macOS version of RIME) is also affected when its default luna_pinyin scheme is loaded. RIME only uses So it seems to be not necessary anymore to attempt to discuss with devs of SogouIME and WeChat_IME. |
|
I just found how Chromium implements NSTextInputClient protocol: I guess this might be a good referential example of implementation. |
|
I looked into firefox yesterday as well, and it looked similar. Though, chromium looks easier to follow in that regard. |
On macOS, make AppKit monitor handle tests derive their reference display IDs from `CGMainDisplayID`, preventing failures on systems where the primary monitor is not display `1`.
6803619 to
e6b4b33
Compare
|
I have no clue how the review request to @kchibisov gets automatically initiated. Sorry for the inconveniences. I'm drafting this PR now and'll fix the commit wording issues until CI passes. |
|
(My mistake. I closed this PR instead... Sigh... It's not reopenable now.) |
changelogmodule if knowledge of this change could be valuable to usersThe true reason for this PR is to allow IME devs to automatically enable their customized popup composition buffer window in lieu of preedit (inline composition buffer). This is at least better than waiting for a lot of months seeing some IME-related PR patches are not mergeable in this
winitrepository due to maintainers' concerns.