From 28b80455f97dbe21d5d9845b85928feca652c518 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 3 Feb 2025 17:12:24 -0700 Subject: [PATCH] Fix missing modifier changed events on Linux X11 (#24154) Release Notes: - Fixed some modifier changed events not being present on Linux X11. This affected things like the project search palette, where holding ctrl would not cause the split options to appear. --- crates/gpui/src/platform/linux/x11/client.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index 1bd7d9a305ca714193d923f74bb5f16a6bbcc166..4a4521b35d05cac960442c394ae01df831572660 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -186,6 +186,8 @@ pub struct X11ClientState { pub(crate) ximc: Option>>, pub(crate) xim_handler: Option, pub modifiers: Modifiers, + // TODO: Can the other updates to `modifiers` be removed so that this is unnecessary? + pub last_modifiers_changed_event: Modifiers, pub(crate) compose_state: Option, pub(crate) pre_edit_text: Option, @@ -434,6 +436,7 @@ impl X11Client { X11Client(Rc::new(RefCell::new(X11ClientState { modifiers: Modifiers::default(), + last_modifiers_changed_event: Modifiers::default(), event_loop: Some(event_loop), loop_handle: handle, common, @@ -867,11 +870,12 @@ impl X11Client { } let modifiers = Modifiers::from_xkb(&state.xkb); - if state.modifiers == modifiers { + if state.last_modifiers_changed_event == modifiers { drop(state); } else { let focused_window_id = state.keyboard_focused_window?; state.modifiers = modifiers; + state.last_modifiers_changed_event = modifiers; drop(state); let focused_window = self.get_window(focused_window_id)?;