From e4effa5e014ae79004550bac73a91d98abc95796 Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Mon, 14 Jul 2025 12:44:29 +0300 Subject: [PATCH] linux: Fix keycodes mapping on Wayland (#34396) We are already converting Wayland keycodes to X11's; double conversion results in a wrong mapping. Release Notes: - N/A --- crates/gpui/src/platform/linux/platform.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 8c9fd672b617abbc52c4a5263d4a19984d09c6ca..743cac71f37d44ea187b0301bdf43c305cac8d04 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -715,12 +715,10 @@ pub(crate) enum KeycodeSource { #[cfg(any(feature = "wayland", feature = "x11"))] impl KeycodeSource { fn guess_ascii(&self, keycode: Keycode, shift: bool) -> Option { - let raw = match self { - // For historical reasons X11 adds 8 to keycodes - Self::X11 => keycode.raw() - 8, - // For no particular reason, wayland doesn't. - Self::Wayland => keycode.raw(), - }; + // For historical reasons, X11 adds 8 to keycodes. + // Wayland doesn't, but by this point, our own Wayland client + // has added 8 for X11 compatibility. + let raw = keycode.raw() - 8; let c = match (raw, shift) { (16, _) => 'q', (17, _) => 'w',