-
Notifications
You must be signed in to change notification settings - Fork 930
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
Add new IME
event for desktop platforms
#2243
Conversation
cc40407
to
8e966e6
Compare
8e966e6
to
5db61c1
Compare
Now it has complete support across desktop platforms, so reviews are welcome. |
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.
Only looked at the Linux implementations, but seems good to me mostly.
bc90c3d
to
a90407a
Compare
Also, what do you think about naming it There's also an issue wrt setting surrounding text, but I think it could be done separately, since the original PR is more about event and not about IME helpers, since those helpers are not really required. |
a90407a
to
3c0a180
Compare
|
Pretty sure clippy even lints against |
c5e571c
to
2a0f171
Compare
I've done all renaming, if there won't be any issues raised until 23.04.2022 I'll merge it that day. |
2a0f171
to
98540a6
Compare
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 created #2258 for some work on documentation that I'd like in this.
MacOS implementation looks good enough for me for now, I'll probably clean some things up after we fully revamp the keyboard API, but that's not a blocker for this.
First of all thanks for all your work guys! This is definitely one of the bigger improvements in winit. Although I found a bug. I don't get Commit events on X11 with the Pinyin input. (Ubuntu 20.04) I called I type type: The input selection box shows up correctly and I get the following events
Then I press 1 and the input selection box disappears but I don't get a
The same happens if I press Return or Space instead of 1 (except of course I get the release event for the released key at the end) |
In case someone has documentation suggestions, feel free to add them in #2258. |
98540a6
to
a4fb378
Compare
@ArturKovacs would you mind looking into I can't repro that with default gnome + Pinyin on fedora 35. It works as expected for me. It shouldn't be that hard to figure it out. If you don't have time to look into it, you should likely tell me what's your setup is so I can try to repro, though it'll take time that way. Though, it's kind of interesting that |
That's odd. I added Maybe we should continue this conversation on Matrix, I could share my screen in a call if you want. |
@ArturKovacs I'll try to look around and see what we can do here. Maybe XIM wants to insert text at different point other than in Done callback, but at least on fedora default IME setup everything works as expected... |
@ArturKovacs would you mind trying latest commit on X11 one more time, it should work now from what I can see. |
Also, should we do anything wrt keyboard input during IME input on X11? Should we not send it at all? What do you think @ArturKovacs ? |
cd74e2b
to
de588c9
Compare
It works! You're a genius! Regarding the keyboard input during preedit, I think we agreed that we never send that. |
I've altered that as well, so it should work. While working with preedit downstream, I've noticed that I'd like to have some sort of indication when preedit gets cleared, so when winit is sending |
86c5257
to
0f30ac6
Compare
You mean we could do the following: enum Ime {
// ...
Preedit(String, usize, usize),
PreeditCleared,
// ...
} With a translation of: let new = match old {
Preedit(string, None) => PreeditCleared,
Preedit(string, Some((begin, end))) => Preedit(string, begin, end),
} That is, |
No, when that |
And Anyway, seems to me like we're adding a state that is representable in multiple ways - but then again, I'm fairly certain macOS doesn't really have the concept of |
The purpouse to indicate that there's no preedit, so application can start processing normal keys input again? Certain IMEs are a bot fynamic here and forward regular keyboard input when preedit goes to empty string. |
I still don't understand why we would need such an event. Winit should never send keyboard input events during preedit according to what we agreed. In other words: the application should always process KeyboardInput events because they only arrive outside of preedit. Therefore there's no need to indicate that the preedit ended. |
Hm, I guess that's ok then. So besides upcoming changes to docs I don't see anything blocking it. |
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.
API and macOS LGTM 👍
This commit brings new Ime event to account for preedit state of input method, also adding `Window::set_ime_allowed` to toggle IME input on the particular window. This commit implements API as designed in #1497 for desktop platforms. Co-authored-by: Artur Kovacs <kovacs.artur.barnabas@gmail.com> Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com> Co-authored-by: Murarth <murarth@gmail.com> Co-authored-by: Yusuke Kominami <yukke.konan@gmail.com> Co-authored-by: moko256 <koutaro.mo@gmail.com>
f699224
to
aa9c7be
Compare
Given that we had approval from each platform(except X11 due to missing maintainer, but backend was tested and originally submitted from one of them), we should be fine. Issues that arise will be addressed latter on. |
This commit brings new IME event to account for preedit state of input
method, also adding
Window::set_ime_allowed
to toggle IME input onthe particular window.
This commit implements API as designed in #1497 for Wayland, X11, and
macOS.
Fixes #2174.
Co-authored-by: Artur Kovacs kovacs.artur.barnabas@gmail.com
Co-authored-by: Murarth murarth@gmail.com
Co-authored-by: Yusuke Kominami yukke.konan@gmail.com
--
I've finished implementing X11/Wayland bits. All functionality is supported across X11, Wayland, and macOS. The downstream implementation of new event handling is present in alacritty/alacritty#5790.
The PR handles all the platforms currently having IME input in winit, so there're no blocks left.
I've tested all the implementations with mentioned client and they worked as intedend from my experience, though I haven't payed much attention to macOS one, but at least it works.
cc @chrisduerr @garasubo