Windows: Preserve minimized/maximized state in fullscreen (#1784)
This commit is contained in:
parent
6db308f1e9
commit
39573d65d0
3 changed files with 31 additions and 51 deletions
|
|
@ -39,8 +39,7 @@ pub struct WindowState {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct SavedWindow {
|
||||
pub client_rect: RECT,
|
||||
pub scale_factor: f64,
|
||||
pub placement: winuser::WINDOWPLACEMENT,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
@ -86,11 +85,6 @@ bitflags! {
|
|||
|
||||
const MINIMIZED = 1 << 12;
|
||||
|
||||
const FULLSCREEN_AND_MASK = !(
|
||||
WindowFlags::DECORATIONS.bits |
|
||||
WindowFlags::RESIZABLE.bits |
|
||||
WindowFlags::MAXIMIZED.bits
|
||||
);
|
||||
const EXCLUSIVE_FULLSCREEN_OR_MASK = WindowFlags::ALWAYS_ON_TOP.bits;
|
||||
const NO_DECORATIONS_AND_MASK = !WindowFlags::RESIZABLE.bits;
|
||||
const INVISIBLE_AND_MASK = !WindowFlags::MAXIMIZED.bits;
|
||||
|
|
@ -181,10 +175,7 @@ impl MouseProperties {
|
|||
impl WindowFlags {
|
||||
fn mask(mut self) -> WindowFlags {
|
||||
if self.contains(WindowFlags::MARKER_EXCLUSIVE_FULLSCREEN) {
|
||||
self &= WindowFlags::FULLSCREEN_AND_MASK;
|
||||
self |= WindowFlags::EXCLUSIVE_FULLSCREEN_OR_MASK;
|
||||
} else if self.contains(WindowFlags::MARKER_BORDERLESS_FULLSCREEN) {
|
||||
self &= WindowFlags::FULLSCREEN_AND_MASK;
|
||||
}
|
||||
if !self.contains(WindowFlags::VISIBLE) {
|
||||
self &= WindowFlags::INVISIBLE_AND_MASK;
|
||||
|
|
@ -235,6 +226,12 @@ impl WindowFlags {
|
|||
style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU;
|
||||
style_ex |= WS_EX_ACCEPTFILES;
|
||||
|
||||
if self.intersects(
|
||||
WindowFlags::MARKER_EXCLUSIVE_FULLSCREEN | WindowFlags::MARKER_BORDERLESS_FULLSCREEN,
|
||||
) {
|
||||
style &= !WS_OVERLAPPEDWINDOW;
|
||||
}
|
||||
|
||||
(style, style_ex)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue