Skip to content

Commit

Permalink
fix(Windows): fix set_minimized with Win + D (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Mar 7, 2023
1 parent 1be2574 commit 373ca43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/win+d-minimized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Windows, fix `Window::set_minimized(false)` not working when the window was minimized using `Win + D` hotkey.
8 changes: 6 additions & 2 deletions src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,12 @@ impl Window {
let window = self.window.clone();
let window_state = Arc::clone(&self.window_state);

let is_minimized = self.is_minimized();

self.thread_executor.execute_in_thread(move || {
WindowState::set_window_flags_in_place(&mut window_state.lock(), |f| {
f.set(WindowFlags::MINIMIZED, is_minimized)
});
WindowState::set_window_flags(window_state.lock(), window.0, |f| {
f.set(WindowFlags::MINIMIZED, minimized)
});
Expand All @@ -512,8 +517,7 @@ impl Window {

#[inline]
pub fn is_minimized(&self) -> bool {
let window_state = self.window_state.lock();
window_state.window_flags.contains(WindowFlags::MINIMIZED)
unsafe { IsIconic(self.hwnd()) }.as_bool()
}

#[inline]
Expand Down

0 comments on commit 373ca43

Please sign in to comment.