Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui_linux: Force a full render on X11 Expose after GPU recovery (#64570)
Agus Zubiagaf25434f3c5a8
diff --git a/crates/gpui_linux/src/linux/x11/client.rs b/crates/gpui_linux/src/linux/x11/client.rsindex 3ab9a6e6e4a..23a9a91a976 100644--- a/crates/gpui_linux/src/linux/x11/client.rs+++ b/crates/gpui_linux/src/linux/x11/client.rs@@ -2007,14 +2007,11 @@ impl X11ClientState {let mut state = client.0.borrow_mut();let xcb_connection = state.xcb_connection.clone();if let Some(window) = state.windows.get_mut(&x_window) {- let force_render = std::mem::take(- &mut window.window.state.borrow_mut().force_render_after_recovery,- );let window = window.window.clone();drop(state);window.refresh(RequestFrameOptions {require_presentation: false,- force_render,+ force_render: false,});}xcb_connectiondiff --git a/crates/gpui_linux/src/linux/x11/window.rs b/crates/gpui_linux/src/linux/x11/window.rsindex 56b3d8a9063..3d33ab0c114 100644--- a/crates/gpui_linux/src/linux/x11/window.rs+++ b/crates/gpui_linux/src/linux/x11/window.rs@@ -283,7 +283,7 @@ pub struct X11WindowState {/// `VisibilityNotify`; this is the last value it reported.visibility: WindowVisibility,hovered: bool,- pub(crate) force_render_after_recovery: bool,+ force_render_after_recovery: bool,fullscreen: bool,client_side_decorations_supported: bool,decorations: WindowDecorations,@@ -1181,9 +1181,13 @@ impl X11WindowStatePtr {}}- pub fn refresh(&self, request_frame_options: RequestFrameOptions) {+ pub fn refresh(&self, mut request_frame_options: RequestFrameOptions) {let callback = self.callbacks.borrow_mut().request_frame.take();if let Some(mut fun) = callback {+ // Expose events can present a frame before the refresh timer runs,+ // so every frame request must rebuild stale atlas references after recovery.+ request_frame_options.force_render |=+ std::mem::take(&mut self.state.borrow_mut().force_render_after_recovery);fun(request_frame_options);self.callbacks.borrow_mut().request_frame = Some(fun);}