Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix a bug from the Linux rewrite where Wayland windows would not render properly (#10343)
Mikayla Maki3fc08a0610fa
diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rsindex 069b5abc2b3..fcf56518c43 100644--- a/crates/gpui/src/platform/linux/wayland/client.rs+++ b/crates/gpui/src/platform/linux/wayland/client.rs@@ -446,11 +446,12 @@ impl Dispatch<xdg_surface::XdgSurface, ObjectId> for WaylandClient {_: &QueueHandle<Self>,) {let mut state = state.0.borrow_mut();+ let Some(window) = state.windows.get(surface_id).cloned() else {+ return;+ };- // todo(linux): Apply the configuration changes as we go- if let xdg_surface::Event::Configure { serial, .. } = event {- xdg_surface.ack_configure(serial);- }+ drop(state);+ window.handle_xdg_surface_event(event);}}diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rsindex dd6884ad64b..9853d183144 100644--- a/crates/gpui/src/platform/linux/wayland/window.rs+++ b/crates/gpui/src/platform/linux/wayland/window.rs@@ -67,7 +67,7 @@ unsafe impl HasRawDisplayHandle for RawWindow {pub struct WaylandWindowState {xdg_surface: xdg_surface::XdgSurface,- surface: wl_surface::WlSurface,+ pub surface: wl_surface::WlSurface,toplevel: xdg_toplevel::XdgToplevel,viewport: Option<wp_viewport::WpViewport>,outputs: HashSet<ObjectId>,@@ -209,6 +209,18 @@ impl WaylandWindow {}}+ pub fn handle_xdg_surface_event(&self, event: xdg_surface::Event) {+ match event {+ xdg_surface::Event::Configure { serial } => {+ let state = self.state.borrow();+ state.xdg_surface.ack_configure(serial);+ drop(state);+ self.frame();+ }+ _ => {}+ }+ }+pub fn handle_toplevel_decoration_event(&self, event: zxdg_toplevel_decoration_v1::Event) {match event {zxdg_toplevel_decoration_v1::Event::Configure { mode } => match mode {@@ -253,6 +265,7 @@ impl WaylandWindow {self.set_fullscreen(fullscreen);let mut state = self.state.borrow_mut();state.maximized = true;+false}xdg_toplevel::Event::Close => {