Add WindowBuilder::with_active

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
Amr Bashir 2023-01-27 07:08:29 +02:00 committed by GitHub
parent 930df0ec45
commit b457329003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 60 additions and 5 deletions

View file

@ -1076,6 +1076,7 @@ where
WindowFlags::NO_BACK_BUFFER,
pl_attribs.no_redirection_bitmap,
);
window_flags.set(WindowFlags::MARKER_ACTIVATE, attributes.active);
window_flags.set(WindowFlags::TRANSPARENT, attributes.transparent);
// WindowFlags::VISIBLE and MAXIMIZED are set down below after the window has been configured.
window_flags.set(WindowFlags::RESIZABLE, attributes.resizable);

View file

@ -116,6 +116,8 @@ bitflags! {
/// Drop shadow for undecorated windows.
const MARKER_UNDECORATED_SHADOW = 1 << 20;
const MARKER_ACTIVATE = 1 << 18;
const EXCLUSIVE_FULLSCREEN_OR_MASK = WindowFlags::ALWAYS_ON_TOP.bits;
}
}
@ -306,8 +308,14 @@ impl WindowFlags {
}
if new.contains(WindowFlags::VISIBLE) {
let flag = !if self.contains(WindowFlags::MARKER_ACTIVATE) {
self.set(WindowFlags::MARKER_ACTIVATE, true);
SWP_NOACTIVATE
} else {
SW_SHOW
};
unsafe {
ShowWindow(window, SW_SHOW);
ShowWindow(window, flag);
}
}