fix: use enable and disable methods
This commit is contained in:
parent
344567dd8d
commit
61cdb6fe1f
2 changed files with 24 additions and 7 deletions
|
|
@ -188,8 +188,12 @@ pub enum Action {
|
||||||
|
|
||||||
/// Recompute the layouts of all the windows.
|
/// Recompute the layouts of all the windows.
|
||||||
RelayoutAll,
|
RelayoutAll,
|
||||||
/// Set window blur.
|
|
||||||
SetBlur(bool),
|
/// Enable window blur.
|
||||||
|
EnableBlur(Id),
|
||||||
|
|
||||||
|
/// Disable window blur.
|
||||||
|
DisableBlur(Id),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A window managed by iced.
|
/// A window managed by iced.
|
||||||
|
|
@ -541,8 +545,16 @@ pub fn allow_automatic_tabbing<T>(enabled: bool) -> Task<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the blur effect for the window.
|
/// Sets the blur effect for the window.
|
||||||
|
/// Enable the blur effect for a window.
|
||||||
///
|
///
|
||||||
/// This is only supported on platforms that support window blur.
|
/// This is only supported on platforms that support window blur.
|
||||||
pub fn set_blur<Message>(enable: bool) -> Task<Message> {
|
pub fn enable_blur<Message>(id: Id) -> Task<Message> {
|
||||||
task::effect(crate::Action::Window(Action::SetBlur(enable)))
|
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<Message>(id: Id) -> Task<Message> {
|
||||||
|
task::effect(crate::Action::Window(Action::DisableBlur(id)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1960,9 +1960,14 @@ fn run_action<'a, P, C>(
|
||||||
window.raw.request_redraw();
|
window.raw.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window::Action::SetBlur(enable) => {
|
window::Action::EnableBlur(id) => {
|
||||||
for (_, window) in window_manager.iter_mut() {
|
if let Some(window) = window_manager.get_mut(id) {
|
||||||
window.raw.set_blur(enable);
|
window.raw.set_blur(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window::Action::DisableBlur(id) => {
|
||||||
|
if let Some(window) = window_manager.get_mut(id) {
|
||||||
|
window.raw.set_blur(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue