Skip to content

Commit

Permalink
On Windows, add support for Window::set_transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
kchibisov committed Oct 27, 2023
1 parent 12dbbf8 commit eaa42f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Unreleased` header.
- On Wayland, ignore resize requests when the window is fully tiled.
- On Wayland, use `configure_bounds` to constrain `with_inner_size` when compositor wants users to pick size.
- On Windows, fix deadlock when accessing the state during `Cursor{Enter,Leave}`.
- On Windows, add support for `Window::set_transparent`.
- On macOS, fix deadlock when entering a nested event loop from an event handler.

# 0.29.2
Expand Down
11 changes: 10 additions & 1 deletion src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,16 @@ impl Window {
}
}

pub fn set_transparent(&self, _transparent: bool) {}
pub fn set_transparent(&self, transparent: bool) {
let window = self.window.clone();
let window_state = Arc::clone(&self.window_state);
self.thread_executor.execute_in_thread(move || {
let _ = &window;
WindowState::set_window_flags(window_state.lock().unwrap(), window.0, |f| {
f.set(WindowFlags::TRANSPARENT, transparent)
});
});
}

pub fn set_blur(&self, _blur: bool) {}

Expand Down
2 changes: 1 addition & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ impl Window {
///
/// ## Platform-specific
///
/// - **Windows / Web / iOS / Android / Orbital:** Unsupported.
/// - **Web / iOS / Android / Orbital:** Unsupported.
/// - **X11:** Can only be set while building the window, with [`WindowBuilder::with_transparent`].
#[inline]
pub fn set_transparent(&self, transparent: bool) {
Expand Down

0 comments on commit eaa42f2

Please sign in to comment.