From ee4e43f1b6b347f271fb8bd1c4f8bc6db319f223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Thu, 22 May 2025 22:47:23 +0800 Subject: [PATCH] linux: Fix wrong keys are reported when using German layout (#31193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #31174 Because the keyboard layout parameter wasn’t set correctly, characters don’t show up properly when using the German layout at launch. To reproduce: Switch to the German layout, launch Zed, and press the `7` key. it should output `7`, but instead it outputs `è`. Release Notes: - N/A --- crates/gpui/src/platform/linux/x11/client.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index a59825b292..4565570f20 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -840,6 +840,14 @@ impl X11Client { state.xkb_device_id, ) }; + let depressed_layout = xkb_state.serialize_layout(xkbc::STATE_LAYOUT_DEPRESSED); + let latched_layout = xkb_state.serialize_layout(xkbc::STATE_LAYOUT_LATCHED); + let locked_layout = xkb_state.serialize_layout(xkbc::ffi::XKB_STATE_LAYOUT_LOCKED); + state.previous_xkb_state = XKBStateNotiy { + depressed_layout, + latched_layout, + locked_layout, + }; state.xkb = xkb_state; } Event::XkbStateNotify(event) => {