-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Linux input method support #44
Comments
Western users need it as well :) |
As discussed in IRC, I plan to work on this issue. According to my own experience and after some research online, I propose using XIM (X Input Method) to have an experimental implementation and basic support for XIM-aware input methods. The reason we don't consider other frameworks is because there is still dispute among them (fcitx vs ibus), and the IME framework scenario for X11 is still a mess. We don't want to first be adhere to fcitx or ibus since people only use one of them and both of them provide with support for XIM. As for GTK/QT im modules, since I believe this project does not want to introduce any dependency on either of them, we are not able to use any of their support. As a heavy urxvt user, I personally feel comfortable with what urxvt supports for basic IME, and urxvt uses XIM with no surprise. A good reference is https://www.x.org/releases/X11R7.6/doc/libX11/specs/libX11/libX11.html#Input_Methods. Also urxvt provides with code for a typical use of XIM. This is so far the best plan I could think of, and alacritty also uses x11-dl, which is a Rust port of xlib, so it should be convenient to start the implementation. @jwilm What do you think? I can start with trying to spawn the IME in a very simple example of winit where there is no text lines or cursors, the first thing I need to make sure is that the example program is able to redirect to users' input to the appropriate IM via XIM and obtain the finalized wide character string and print it out to the terminal, in order to prove the concept. After this, I could try to incorporate this into alacritty code. More advanced features such as pre-editing should be tried and introduced later. TL;DR: start with XIM first, since all main-stream input engines/framework has legacy support for it and there seems to be no other better choice although XIM is pretty old. But at least, we are able to achieve a similar experience to what urxvt provides. |
What kind of Wayland support does XIM have? |
XIM is a pretty old standard, way before Wayland was born. So XIM does not support Wayland. But I guess since Wayland can run X11 programs, it also provides with xlib where XIM can be used. |
Replying here in addition to IRC - XIM sounds like the way to go. From what I understand, Wayland will have a different solution. Rather add some support now than not. This seems like it should be added to winit rather than Alacritty; however, it sounds like you're suggesting the reverse. Is there a reason this couldn't be added to winit? |
Does alacritty current use winit to get the input text? Not very sure how alacritty is connected to winit. It could also be a problem if we would like to support preediting in the end (when a user is typing, the intermediate candidates are shown and corrected in the terminal line). But you are right, I also hope we could entirely do this in winit, rather than directly in alacritty. |
Yep, Alacritty uses winit for text input. Currently, it's this I imagine that implementing this in |
|
@quininer oh wow, thanks for the link! Have you tried it out at all? |
@jwilm No, I don't know how to make it work. :( |
@quininer It's currently undocumented... It is not clear what Windows2 is for at the first glance. Maybe we should call some API to enable the IME. |
I guess instead of instantiate Window, in |
Looks like that code was introduced all the way back in 2014 in rust-windowing/winit@26fec19. It's quite possible full IME support isn't done. |
This issue seems relevant rust-windowing/winit#195 |
Also some relevant comments in rust-windowing/glutin#721 |
Got the IME popped out. Should use |
Although winit has implemented |
In order to activate the desired IME, we are supposed to set locale and locale modifier appropriately. for my machine, I use
Also it seems that if we specify an empty string for either of them, system seems to figure out the correct one from the environment variables.
Here is the code that works without hacking winit. |
Great! Then just wait to update glutin. |
@quininer and also implement basic re-positioning of IME box. Looking forward to the update. After all these deps are consistent, I could submit a PR to bring in basic IME support. |
Yay, was waiting this for so long! |
XIM has been supported! |
For some reason, ibus isn't working on my end. Using wayland, ibus is spawned as |
Same here on Sway, using fcitx. Input works in native wayland qt/gtk clients, works in Alacritty when run as an XWayland client, but doesn't work when I run Alacritty as a Wayland client. |
Asian users often need to use input method (like fcitx, ibus). :D
The text was updated successfully, but these errors were encountered: