diff --git a/crates/eframe/src/epi.rs b/crates/eframe/src/epi.rs index e6442736..9b915b95 100644 --- a/crates/eframe/src/epi.rs +++ b/crates/eframe/src/epi.rs @@ -789,6 +789,12 @@ impl Frame { } } + /// Minimize or un-minimize window + #[cfg(not(target_arch = "wasm32"))] + pub fn set_minimized(&mut self, minimized: bool) { + self.output.minimized = Some(minimized); + } + /// for integrations only: call once per frame pub(crate) fn take_app_output(&mut self) -> backend::AppOutput { std::mem::take(&mut self.output) @@ -1002,5 +1008,9 @@ pub(crate) mod backend { /// Set to some bool to tell the window always on top. #[cfg(not(target_arch = "wasm32"))] pub always_on_top: Option, + + /// Set to some bool to change window minimization + #[cfg(not(target_arch = "wasm32"))] + pub minimized: Option, } } diff --git a/crates/eframe/src/native/epi_integration.rs b/crates/eframe/src/native/epi_integration.rs index ff54d12f..c89cbfba 100644 --- a/crates/eframe/src/native/epi_integration.rs +++ b/crates/eframe/src/native/epi_integration.rs @@ -180,6 +180,7 @@ pub fn handle_app_output( window_pos, visible: _, // handled in post_present always_on_top, + minimized, } = app_output; if let Some(decorated) = decorated { @@ -218,6 +219,10 @@ pub fn handle_app_output( if let Some(always_on_top) = always_on_top { window.set_always_on_top(always_on_top); } + + if let Some(minimized) = minimized { + window.set_minimized(minimized); + } } // ----------------------------------------------------------------------------