Skip to content

Commit

Permalink
improv: expose set_blur
Browse files Browse the repository at this point in the history
  • Loading branch information
edfloreshz authored and wash2 committed Oct 30, 2024
1 parent a92abc8 commit ebdfa68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions runtime/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ pub enum Action {
/// This enables mouse events for the window and stops mouse events
/// from being passed to whatever is underneath.
DisableMousePassthrough(Id),

/// Set window blur.
SetBlur(bool),
}

/// Subscribes to the frames of the window of the running application.
Expand Down Expand Up @@ -456,3 +459,10 @@ pub fn enable_mouse_passthrough<Message>(id: Id) -> Task<Message> {
pub fn disable_mouse_passthrough<Message>(id: Id) -> Task<Message> {
task::effect(crate::Action::Window(Action::DisableMousePassthrough(id)))
}

/// 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)))
}
5 changes: 5 additions & 0 deletions winit/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,11 @@ fn run_action<P, C>(
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);
}
}
},
Action::System(action) => match action {
system::Action::QueryInformation(_channel) => {
Expand Down

0 comments on commit ebdfa68

Please sign in to comment.