Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window can't be hidden when maximized #384

Merged
merged 5 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch
---

Fix window can't be hidden when maximized.
14 changes: 13 additions & 1 deletion src/platform_impl/windows/window_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,19 @@ impl WindowFlags {
self = self.mask();
new = new.mask();

let diff = self ^ new;
let mut diff = self ^ new;

// when hiding a maximized window, `self` contains `WindowFlags::MAXIMIZED`
// but `new` won't have it as it is removed in `new.mask()` call by applying `WindowFlags::INVISIBLE_AND_MASK`
// so `diff` will contain `WindowFlags::MAXIMIZED` and that will cause the window to unmaximize, but
// since we are trying to hide the window, we need to apply `WindowFlags::INVISIBLE_AND_MASK` on `diff` too.
if diff.contains(WindowFlags::MAXIMIZED)
&& diff.contains(WindowFlags::VISIBLE)
&& !new.contains(WindowFlags::VISIBLE)
{
diff &= WindowFlags::INVISIBLE_AND_MASK;
}

if diff == WindowFlags::empty() {
return;
}
Expand Down