diff --git a/crates/gpui_linux/src/linux/x11/client.rs b/crates/gpui_linux/src/linux/x11/client.rs index 6ba8583ce6..9b35125da1 100644 --- a/crates/gpui_linux/src/linux/x11/client.rs +++ b/crates/gpui_linux/src/linux/x11/client.rs @@ -820,15 +820,19 @@ impl X11Client { Event::ClientMessage(event) => { let window = self.get_window(event.window)?; let [atom, arg1, arg2, arg3, arg4] = event.data.as_data32(); - let mut state = self.0.borrow_mut(); + let delete_window_atom = self.0.borrow().atoms.WM_DELETE_WINDOW; - if atom == state.atoms.WM_DELETE_WINDOW && window.should_close() { - // window "x" button clicked by user - // Rest of the close logic is handled in drop_window() - drop(state); - window.close(); - state = self.0.borrow_mut(); - } else if atom == state.atoms._NET_WM_SYNC_REQUEST { + if atom == delete_window_atom { + if window.should_close() { + // window "x" button clicked by user + // Rest of the close logic is handled in drop_window() + window.close(); + } + return Some(()); + } + + let mut state = self.0.borrow_mut(); + if atom == state.atoms._NET_WM_SYNC_REQUEST { window.state.borrow_mut().last_sync_counter = Some(x11rb::protocol::sync::Int64 { lo: arg2,