--- a/src/app.rs +++ b/src/app.rs @@ -982,0 +983,5 @@ + /// Keep the native loop alive when the last window closes (for tray apps). + pub fn set_quit_on_last_window_close(&self, quit: bool) { + self.platform.set_quit_on_last_window_close(quit); + } + --- a/src/platform/linux/platform.rs +++ b/src/platform/linux/platform.rs @@ -96,0 +97 @@ + pub quit_on_last_window_close: bool, @@ -122,0 +124 @@ + quit_on_last_window_close: true, @@ -232,0 +235,4 @@ + } + + fn set_quit_on_last_window_close(&self, quit: bool) { + self.with_common(|common| common.quit_on_last_window_close = quit); --- a/src/platform/linux/wayland/client.rs +++ b/src/platform/linux/wayland/client.rs @@ -387 +387 @@ - if state.windows.is_empty() { + if state.windows.is_empty() && state.common.quit_on_last_window_close { --- a/src/platform/linux/x11/client.rs +++ b/src/platform/linux/x11/client.rs @@ -250 +250 @@ - if state.windows.is_empty() { + if state.windows.is_empty() && state.common.quit_on_last_window_close { --- a/src/platform/windows/platform.rs +++ b/src/platform/windows/platform.rs @@ -2 +2 @@ - cell::RefCell, + cell::{Cell, RefCell}, @@ -45,0 +46 @@ + quit_on_last_window_close: Cell, @@ -369,0 +371,4 @@ + fn set_quit_on_last_window_close(&self, quit: bool) { + self.inner.quit_on_last_window_close.set(quit); + } + @@ -682,0 +688 @@ + quit_on_last_window_close: Cell::new(true), @@ -744 +750 @@ - lock.is_empty() + lock.is_empty() && self.quit_on_last_window_close.get() --- a/src/platform.rs +++ b/src/platform.rs @@ -171,0 +172 @@ + fn set_quit_on_last_window_close(&self, _quit: bool) {} --- a/src/taffy.rs +++ b/src/taffy.rs @@ -312 +312 @@ - unit.map(|count| vec![repeat(count, vec![minmax(length(0.0), fr(1.0))])]) + unit.map(|count| vec![repeat(count, vec![minmax(length(0.0_f32), fr(1.0_f32))])])