diff --git a/runtime/src/window.rs b/runtime/src/window.rs index ba96a04e..15d6f989 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -188,8 +188,12 @@ pub enum Action { /// Recompute the layouts of all the windows. RelayoutAll, - /// Set window blur. - SetBlur(bool), + + /// Enable window blur. + EnableBlur(Id), + + /// Disable window blur. + DisableBlur(Id), } /// A window managed by iced. @@ -541,8 +545,16 @@ pub fn allow_automatic_tabbing(enabled: bool) -> Task { } /// Sets the blur effect for the window. +/// Enable the blur effect for a window. /// /// This is only supported on platforms that support window blur. -pub fn set_blur(enable: bool) -> Task { - task::effect(crate::Action::Window(Action::SetBlur(enable))) +pub fn enable_blur(id: Id) -> Task { + task::effect(crate::Action::Window(Action::EnableBlur(id))) +} + +/// Enable the blur effect for a window. +/// +/// This is only supported on platforms that support window blur. +pub fn disable_blur(id: Id) -> Task { + task::effect(crate::Action::Window(Action::DisableBlur(id))) } diff --git a/winit/src/lib.rs b/winit/src/lib.rs index f558189f..a6f5e4b2 100644 --- a/winit/src/lib.rs +++ b/winit/src/lib.rs @@ -1960,9 +1960,14 @@ 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); + window::Action::EnableBlur(id) => { + if let Some(window) = window_manager.get_mut(id) { + window.raw.set_blur(true); + } + } + window::Action::DisableBlur(id) => { + if let Some(window) = window_manager.get_mut(id) { + window.raw.set_blur(false); } } },