improv: expose set_blur

This commit is contained in:
Eduardo Flores 2024-10-30 16:42:25 +01:00 committed by Ashley Wulber
parent ac9b0cd357
commit 344567dd8d
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
2 changed files with 14 additions and 0 deletions

View file

@ -188,6 +188,8 @@ pub enum Action {
/// Recompute the layouts of all the windows.
RelayoutAll,
/// Set window blur.
SetBlur(bool),
}
/// A window managed by iced.
@ -537,3 +539,10 @@ pub fn allow_automatic_tabbing<T>(enabled: bool) -> Task<T> {
enabled,
)))
}
/// Sets the blur effect for the window.
///
/// This is only supported on platforms that support window blur.
pub fn set_blur<Message>(enable: bool) -> Task<Message> {
task::effect(crate::Action::Window(Action::SetBlur(enable)))
}

View file

@ -1960,6 +1960,11 @@ fn run_action<'a, P, C>(
window.raw.request_redraw();
}
}
window::Action::SetBlur(enable) => {
for (_, window) in window_manager.iter_mut() {
window.raw.set_blur(enable);
}
}
},
Action::System(action) => match action {
system::Action::GetInformation(_channel) => {