diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 2086ffecba..ff9660b744 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -160,8 +160,11 @@ pub enum Action { /// from being passed to whatever is underneath. DisableMousePassthrough(Id), - /// Set window blur. - SetBlur(bool), + /// Enable window blur. + EnableBlur(Id), + + /// Disable window blur. + DisableBlur(Id), } /// Subscribes to the frames of the window of the running application. @@ -460,9 +463,16 @@ pub fn disable_mouse_passthrough(id: Id) -> Task { task::effect(crate::Action::Window(Action::DisableMousePassthrough(id))) } -/// 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 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 set_blur(enable: bool) -> Task { - task::effect(crate::Action::Window(Action::SetBlur(enable))) +pub fn disable_blur(id: Id) -> Task { + task::effect(crate::Action::Window(Action::DisableBlur(id))) } diff --git a/winit/src/program.rs b/winit/src/program.rs index ffc8dd020f..a12ec20bc2 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -2202,9 +2202,14 @@ fn run_action( let _ = window.raw.set_cursor_hittest(true); } } - window::Action::SetBlur(enable) => { - if let Some(window) = window_manager.get_mut(0) { - 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); } } },