Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Move 'app closing on last window closed' behavior to app-side (#41436)
Tryanksddf593789908
diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rsindex ee2590aa4df..fd4d9fb2b31 100644--- a/crates/gpui/src/platform/linux/wayland/client.rs+++ b/crates/gpui/src/platform/linux/wayland/client.rs@@ -387,9 +387,6 @@ impl WaylandClientStatePtr {{state.keyboard_focused_window = Some(window);}- if state.windows.is_empty() {- state.common.signal.stop();- }}}diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rsindex 98e70a3071e..5b0be84b2fc 100644--- a/crates/gpui/src/platform/linux/x11/client.rs+++ b/crates/gpui/src/platform/linux/x11/client.rs@@ -246,10 +246,6 @@ impl X11ClientStatePtr {state.keyboard_focused_window = None;}state.cursor_styles.remove(&x_window);-- if state.windows.is_empty() {- state.common.signal.stop();- }}pub fn update_ime_position(&self, bounds: Bounds<Pixels>) {diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rsindex d236068f3e7..b985cc14b01 100644--- a/crates/gpui/src/platform/windows/platform.rs+++ b/crates/gpui/src/platform/windows/platform.rs@@ -753,9 +753,7 @@ impl WindowsPlatformInner {}match message {WM_GPUI_CLOSE_ONE_WINDOW => {- if self.close_one_window(HWND(lparam.0 as _)) {- unsafe { PostQuitMessage(0) };- }+ self.close_one_window(HWND(lparam.0 as _));Some(0)}WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD => self.run_foreground_task(),diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rsindex d83e1eafc19..7cdaea920f4 100644--- a/crates/zed/src/zed.rs+++ b/crates/zed/src/zed.rs@@ -274,16 +274,27 @@ pub fn init(cx: &mut App) {}fn bind_on_window_closed(cx: &mut App) -> Option<gpui::Subscription> {- WorkspaceSettings::get_global(cx)- .on_last_window_closed- .is_quit_app()- .then(|| {- cx.on_window_closed(|cx| {- if cx.windows().is_empty() {- cx.quit();- }+ #[cfg(target_os = "macos")]+ {+ WorkspaceSettings::get_global(cx)+ .on_last_window_closed+ .is_quit_app()+ .then(|| {+ cx.on_window_closed(|cx| {+ if cx.windows().is_empty() {+ cx.quit();+ }+ })})- })+ }+ #[cfg(not(target_os = "macos"))]+ {+ Some(cx.on_window_closed(|cx| {+ if cx.windows().is_empty() {+ cx.quit();+ }+ }))+ }}pub fn build_window_options(display_uuid: Option<Uuid>, cx: &mut App) -> WindowOptions {