linux: Fix IME on fcitx5 (#14508)

Release Notes:

- linux: Fix IME under fcitx5 (#14192)
This commit is contained in:
Conrad Irwin 2024-07-15 12:07:19 -06:00 committed by GitHub
parent c27c41274a
commit 868455f978
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -990,18 +990,16 @@ impl X11Client {
fn xim_handle_commit(&self, window: xproto::Window, text: String) -> Option<()> {
let window = self.get_window(window).unwrap();
let mut state = self.0.borrow_mut();
if !state.composing {
if let Some(keystroke) = state.pre_ime_key_down.take() {
drop(state);
window.handle_input(PlatformInput::KeyDown(crate::KeyDownEvent {
keystroke,
is_held: false,
}));
return Some(());
}
}
let keystroke = state.pre_ime_key_down.take();
state.composing = false;
drop(state);
if let Some(mut keystroke) = keystroke {
keystroke.ime_key = Some(text.clone());
window.handle_input(PlatformInput::KeyDown(crate::KeyDownEvent {
keystroke,
is_held: false,
}));
}
window.handle_ime_commit(text);
Some(())