From 851997cce4f3f85b3382b30181c77b31cfefb921 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 23 Jan 2024 10:25:52 -0700 Subject: [PATCH] x11: synthesize clearing dead key status when composing via IME We have two different ways to compose: * Via xkbd * Via IME messages In the latter case, we receive notifications from the IME about the composed text, but are apparently not guaranteed to receive them about the composition status overall. This commit will synthesize clearing the composition status when we receive the instruction to emit composed text. The hope is that this will clear the compose cursor state that appears to get stuck for some users of ibus + Gnome 45. refs: https://github.com/wez/wezterm/issues/4841 --- window/src/os/x11/window.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index 7c58ad25e..80f3d4a51 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -679,6 +679,11 @@ impl XWindowInner { .normalize_shift() .resurface_positional_modifier_key(); self.events.dispatch(WindowEvent::KeyEvent(key_event)); + // Since we just composed, synthesize a cleared status, as we + // are not guaranteed to receive an event notification to + // trigger dispatch_ime_compose_status() above. + // + self.events.dispatch(WindowEvent::AdviseDeadKeyStatus(DeadKeyStatus::None)); } /// If we own the selection, make sure that the X server reflects