-
Notifications
You must be signed in to change notification settings - Fork 3
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
Don't initialize IME again while it's already in progress #2
base: main
Are you sure you want to change the base?
Conversation
i think i am hitting this problem too. see yshui/picom#1289. also reported to upstream xcb-imdkit: fcitx/xcb-imdkit#16. Apparently the correctly solution is to only call
|
@wez Hi! This fixes an issue where IME doesn't work on wezterm + X11 + tiling window manager, and what I've changed is making sure Per @wengxt's comment above, it seems like It would be great if you could update wezterm with this pull request! |
eh?
i think you missed the "until a xcb_xim_close is called" part. calling |
@yshui Hi! I haven't had the time to try your changes yet, but I think that may not work(at least for my case) because the primary issue for me was that:
I think calling |
I just added a line that calls |
I'm not exactly sure why it has to be this complex. The procedure should be simply just: Init: Shutdown: Once open_callback is called, you can start to send any input method related request. Until disconnected callback that you set via xcb_xim_set_im_callback is called, then you can assume all the resource you created are invalid (e.g. ic), just discard everything and wait for next open_callback (since auto_connect is true). The auto reconnect is triggered by monitoring the XIM_SERVERS property on root window. Input method restart should initiate a re-connection if previous attempt fails. You shouldn't need to do things like "try_open_ic" when filtering event, or during update_pos in lib.rs. update_pos should be like:
And you can then send cache_pos upon create_ic_callback. Alternatively, you can set auto_connect=false. under current API it is harder to use, the reason is that
If auto_connect=false sounds a better option to you, I can add some API to expose to the internal state to allow you to check the progress of xcb_im_open. |
I'm not sure why you choose to call If not, you can simply move xcb_im_open to initialization code and remove the two call site in lib.rs |
I've recently tried wez/wezterm@30345b3 on Ubuntu 22.04 + X11 + ibus + ibus-hangul, and I've found that the IME isn't working most of the time.
After some debugging, I've discovered that:
try_open_ic
tocreate_ic_callback
) takes some time, up to 100ms, andI've added a guard(with a 5-second timeout, so that it can deal with ime disconnects just in case) to
try_init_ic()
, and now the IME always works, even in the release build.I believe updating wezterm with this change fixes the issue wez/wezterm#5125