Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui_linux: Avoid local XKB files for server keymaps (#64113)

Conrad Irwina7c7219d5bfd
diff --git a/crates/gpui_linux/src/linux/platform.rs b/crates/gpui_linux/src/linux/platform.rs
index 5da8b5a27f1..7bf77a1bc35 100644
--- a/crates/gpui_linux/src/linux/platform.rs
+++ b/crates/gpui_linux/src/linux/platform.rs
@@ -899,9 +899,13 @@ pub(super) fn is_within_click_distance(a: Point<Pixels>, b: Point<Pixels>) -> bo
diff.x.abs() <= DOUBLE_CLICK_DISTANCE && diff.y.abs() <= DOUBLE_CLICK_DISTANCE
}
+/// Creates an XKB context for keymaps supplied by Wayland or X11.
+///
+/// Server keymaps are already resolved and need no local keyboard definitions.
+/// Loading default include paths can fail on systems without those files.
#[cfg(any(feature = "wayland", feature = "x11"))]
pub(super) fn new_xkb_context() -> anyhow::Result<xkb::Context> {
- validate_xkb_context(xkb::Context::new(xkb::CONTEXT_NO_FLAGS))
+ validate_xkb_context(xkb::Context::new(xkb::CONTEXT_NO_DEFAULT_INCLUDES))
}
#[cfg(any(feature = "wayland", feature = "x11"))]
diff --git a/crates/gpui_linux/src/linux/x11/client.rs b/crates/gpui_linux/src/linux/x11/client.rs
index 28c4189ca65..3ab9a6e6e4a 100644
--- a/crates/gpui_linux/src/linux/x11/client.rs
+++ b/crates/gpui_linux/src/linux/x11/client.rs
@@ -2847,7 +2847,9 @@ mod tests {
}
fn test_keymap_with_variant(layouts: &str, variant: &str) -> xkbc::Keymap {
- let context = new_xkb_context().expect("test XKB context should initialize");
+ // These fixtures compile layout names from local files, unlike server keymaps.
+ let context = xkbc::Context::new(xkbc::CONTEXT_NO_FLAGS);
+ assert!(!context.get_raw_ptr().is_null());
xkbc::Keymap::new_from_names(
&context,
"",