add set_minimized for Frame

This commit is contained in:
SunDoge 2022-12-27 21:18:04 +08:00
parent 34f587d1e1
commit 7c2b2149e3
2 changed files with 15 additions and 0 deletions

View file

@ -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<bool>,
/// Set to some bool to change window minimization
#[cfg(not(target_arch = "wasm32"))]
pub minimized: Option<bool>,
}
}

View file

@ -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);
}
}
// ----------------------------------------------------------------------------