-
Notifications
You must be signed in to change notification settings - Fork 903
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
Inform downstream about IME state #1452
Comments
@chrisduerr I implemented IME events interfaces in #1293. It is not merged master because it is implemented only for x11 environment (#1497 is the tracking issue for other platform), but could this be the solution for it? |
It seems like that might make it possible to fix it, yes. Though I do have to say that the naming of these events is extremely unfortunate. |
I don't have a strong preference about naming, but do you have any other ideas about naming? These naming come from web API (https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event). |
That's probably not the best guideline for a toolkit where large parts are completely unrelated to the web. Of course taking inspiration from other APIs is always good, but I don't think it's the best choice here. I've left a suggestion on #1497. |
Also, if we're going to inform downstream about various IME states, I feel like we should add helpers like setting surrounding text around the cursor, content type, etc. The surround text should inform about cursor position, etc. @garasubo since you've been doing some work wrt input method in winit, what do you think about exposing more methods? For Wayland I'd need stuff from https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/unstable/text-input/text-input-unstable-v3.xml . I'm not sure how it maps to whatever X11 has, but I guess everything should have a concept of surrounding text and cursor position? In general, since winit is lacking IME support for a lot of platforms, except macOS/X11 (Wayland will be added very soon). I feel like we can accelerate addition of such things, since those are essential for inline IME edditing, at least surrounding. |
@kchibisov Good point. In my current implmentation, we can get the cursor position, but I didn't consider the surrounding text in IME. I'm not sure we can get the related information from X11. |
I mean, not get but rather set. On Wayland you can tell IME that you have some text around you, so it can suggest things accounting for that. Wayland doesn't know about surrounding text either unless you tell it. |
@kchibisov Oh, you meant preedit string in IME? Then, get is already implemented. For set, I haven't implmented, but looks like we can, according to https://github.com/glfw/glfw/pull/658/files |
I’m mostly talking about set things on a winit window, so user can implement cursor motions inside preedit string. |
This long done. |
This was reported in Alacritty in alacritty/alacritty#1606.
It seems like when the IME interface is open, winit intercepts all
ReceivedCharacter
events and instead forwards them to the IME. This works well for applications that rely solely on winit'sReceivedCharacter
event to insert text, but it creates problems when characters are inserted as a result of other keyboard events.There are several solutions for this, winit could for example not send any keyboard events when the IME is open and instead pretend it is a completely separate window. Alternatively, just informing the application about the current IME state would allow at least conditionally disabling keyboard handling when the interface is open.
The text was updated successfully, but these errors were encountered: