Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Fix inset being used in SSD on Wayland (#35151)
marius851000ee9b60e60ce5
diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rsindex 255ae9c3721..2b2207e22c8 100644--- a/crates/gpui/src/platform/linux/wayland/window.rs+++ b/crates/gpui/src/platform/linux/wayland/window.rs@@ -111,7 +111,7 @@ pub struct WaylandWindowState {resize_throttle: bool,in_progress_window_controls: Option<WindowControls>,window_controls: WindowControls,- inset: Option<Pixels>,+ client_inset: Option<Pixels>,}#[derive(Clone)]@@ -186,7 +186,7 @@ impl WaylandWindowState {hovered: false,in_progress_window_controls: None,window_controls: WindowControls::default(),- inset: None,+ client_inset: None,})}@@ -211,6 +211,13 @@ impl WaylandWindowState {self.display = current_output;scale}++ pub fn inset(&self) -> Pixels {+ match self.decorations {+ WindowDecorations::Server => px(0.0),+ WindowDecorations::Client => self.client_inset.unwrap_or(px(0.0)),+ }+ }}pub(crate) struct WaylandWindow(pub WaylandWindowStatePtr);@@ -380,7 +387,7 @@ impl WaylandWindowStatePtr {configure.size = if got_unmaximized {Some(state.window_bounds.size)} else {- compute_outer_size(state.inset, configure.size, state.tiling)+ compute_outer_size(state.inset(), configure.size, state.tiling)};if let Some(size) = configure.size {state.window_bounds = Bounds {@@ -400,7 +407,7 @@ impl WaylandWindowStatePtr {let window_geometry = inset_by_tiling(state.bounds.map_origin(|_| px(0.0)),- state.inset.unwrap_or(px(0.0)),+ state.inset(),state.tiling,).map(|v| v.0 as i32)@@ -818,7 +825,7 @@ impl PlatformWindow for WaylandWindow {} else if state.maximized {WindowBounds::Maximized(state.window_bounds)} else {- let inset = state.inset.unwrap_or(px(0.));+ let inset = state.inset();drop(state);WindowBounds::Windowed(self.bounds().inset(inset))}@@ -1073,8 +1080,8 @@ impl PlatformWindow for WaylandWindow {fn set_client_inset(&self, inset: Pixels) {let mut state = self.borrow_mut();- if Some(inset) != state.inset {- state.inset = Some(inset);+ if Some(inset) != state.client_inset {+ state.client_inset = Some(inset);update_window(state);}}@@ -1094,9 +1101,7 @@ fn update_window(mut state: RefMut<WaylandWindowState>) {state.renderer.update_transparency(!opaque);let mut opaque_area = state.window_bounds.map(|v| v.0 as i32);- if let Some(inset) = state.inset {- opaque_area.inset(inset.0 as i32);- }+ opaque_area.inset(state.inset().0 as i32);let region = state.globals@@ -1169,12 +1174,10 @@ impl ResizeEdge {/// updating to account for the client decorations. But that's not the area we want to render/// to, due to our intrusize CSD. So, here we calculate the 'actual' size, by adding back in the insetsfn compute_outer_size(- inset: Option<Pixels>,+ inset: Pixels,new_size: Option<Size<Pixels>>,tiling: Tiling,) -> Option<Size<Pixels>> {- let Some(inset) = inset else { return new_size };-new_size.map(|mut new_size| {if !tiling.top {new_size.height += inset;