From a04b3d80c82ba4aa6321a4c3986e9dbcf78c87fa Mon Sep 17 00:00:00 2001 From: Be Date: Fri, 21 Nov 2025 13:55:44 -0600 Subject: [PATCH] gpui: Fall back to client-side decorations on Wayland if SSD not supported (#39313) It is optional for Wayland servers to support server-side decorations. In particular, GNOME chooses to not implement SSD (https://gitlab.gnome.org/GNOME/mutter/-/issues/217). So, even if the application requests SSD, it must draw client-side decorations unless the application receives a response from the server confirming the request for SSD. Before, when the user requested SSD for Zed, but the Wayland server did not support it, there were no server-side decorations (window titlebar) drawn, but Zed did not draw the window minimize, maximize, and close buttons either. This fixes Zed so it always draws the window control buttons if the Wayland server does not support SSD. Before on GNOME Wayland with SSD requested: image After on GNOME Wayland with SSD requested: image Release Notes: - Fixed window control buttons not showing in GNOME Wayland when SSD requested --- .../gpui/src/platform/linux/wayland/window.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index c02d1f3bc3d0d1ecf7589ae959f8c9b0e3f0fde5..3334ae28a31927b2150e79fc513855fa699c55ba 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -1270,10 +1270,21 @@ impl PlatformWindow for WaylandWindow { fn request_decorations(&self, decorations: WindowDecorations) { let mut state = self.borrow_mut(); - state.decorations = decorations; - if let Some(decoration) = state.surface_state.decoration() { - decoration.set_mode(decorations.to_xdg()); - update_window(state); + match state.surface_state.decoration().as_ref() { + Some(decoration) => { + decoration.set_mode(decorations.to_xdg()); + state.decorations = decorations; + update_window(state); + } + None => { + if matches!(decorations, WindowDecorations::Server) { + log::info!( + "Server-side decorations requested, but the Wayland server does not support them. Falling back to client-side decorations." + ); + } + state.decorations = WindowDecorations::Client; + update_window(state); + } } }