🎨 Track/restore original stylemask, rather than individual states.
This commit is contained in:
parent
f256967414
commit
fa4d52f042
2 changed files with 14 additions and 19 deletions
|
@ -196,12 +196,10 @@ class NativeWindowMac : public NativeWindow,
|
||||||
// Simple (pre-Lion) Fullscreen Settings
|
// Simple (pre-Lion) Fullscreen Settings
|
||||||
bool simple_fullscreen_;
|
bool simple_fullscreen_;
|
||||||
bool is_simple_fullscreen_;
|
bool is_simple_fullscreen_;
|
||||||
bool was_maximized_;
|
|
||||||
bool was_minimizable_;
|
|
||||||
bool was_maximizable_;
|
bool was_maximizable_;
|
||||||
bool was_resizable_;
|
|
||||||
bool was_movable_;
|
bool was_movable_;
|
||||||
NSRect original_frame_;
|
NSRect original_frame_;
|
||||||
|
NSUInteger simple_fullscreen_mask_;
|
||||||
|
|
||||||
// The presentation options before entering simple fullscreen mode.
|
// The presentation options before entering simple fullscreen mode.
|
||||||
NSApplicationPresentationOptions simple_fullscreen_options_;
|
NSApplicationPresentationOptions simple_fullscreen_options_;
|
||||||
|
|
|
@ -1372,6 +1372,7 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
||||||
original_frame_ = [window frame];
|
original_frame_ = [window frame];
|
||||||
|
|
||||||
simple_fullscreen_options_ = [NSApp currentSystemPresentationOptions];
|
simple_fullscreen_options_ = [NSApp currentSystemPresentationOptions];
|
||||||
|
simple_fullscreen_mask_ = [window styleMask];
|
||||||
|
|
||||||
// We can simulate the pre-Lion fullscreen by auto-hiding the dock and menu bar
|
// We can simulate the pre-Lion fullscreen by auto-hiding the dock and menu bar
|
||||||
NSApplicationPresentationOptions options =
|
NSApplicationPresentationOptions options =
|
||||||
|
@ -1379,14 +1380,9 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
||||||
NSApplicationPresentationAutoHideMenuBar;
|
NSApplicationPresentationAutoHideMenuBar;
|
||||||
[NSApp setPresentationOptions:options];
|
[NSApp setPresentationOptions:options];
|
||||||
|
|
||||||
was_maximized_ = IsMaximized();
|
|
||||||
was_minimizable_ = IsMinimizable();
|
|
||||||
was_maximizable_ = IsMaximizable();
|
was_maximizable_ = IsMaximizable();
|
||||||
was_resizable_ = IsResizable();
|
|
||||||
was_movable_ = IsMovable();
|
was_movable_ = IsMovable();
|
||||||
|
|
||||||
// if (!was_maximized_) Maximize();
|
|
||||||
|
|
||||||
NSRect fullscreenFrame = [window.screen frame];
|
NSRect fullscreenFrame = [window.screen frame];
|
||||||
|
|
||||||
if ( !fullscreen_window_title() ) {
|
if ( !fullscreen_window_title() ) {
|
||||||
|
@ -1404,11 +1400,11 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
||||||
|
|
||||||
[window setFrame:fullscreenFrame display: YES animate: YES];
|
[window setFrame:fullscreenFrame display: YES animate: YES];
|
||||||
|
|
||||||
// Fullscreen windows can't be resized, minimized, etc.
|
// Fullscreen windows can't be resized, minimized, maximized, or moved
|
||||||
if (was_minimizable_) SetMinimizable(false);
|
SetMinimizable(false);
|
||||||
if (was_maximizable_) SetMaximizable(false);
|
SetResizable(false);
|
||||||
if (was_resizable_) SetResizable(false);
|
SetMaximizable(false);
|
||||||
if (was_movable_) SetMovable(false);
|
SetMovable(false);
|
||||||
} else if (!simple_fullscreen && is_simple_fullscreen_) {
|
} else if (!simple_fullscreen && is_simple_fullscreen_) {
|
||||||
is_simple_fullscreen_ = false;
|
is_simple_fullscreen_ = false;
|
||||||
|
|
||||||
|
@ -1425,13 +1421,14 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
|
||||||
[window setFrame:original_frame_ display: YES animate: YES];
|
[window setFrame:original_frame_ display: YES animate: YES];
|
||||||
|
|
||||||
[NSApp setPresentationOptions:simple_fullscreen_options_];
|
[NSApp setPresentationOptions:simple_fullscreen_options_];
|
||||||
|
|
||||||
|
// Restore original style mask
|
||||||
|
ScopedDisableResize disable_resize;
|
||||||
|
[window_ setStyleMask:simple_fullscreen_mask_];
|
||||||
|
|
||||||
// Restore window manipulation abilities
|
// Restore window manipulation abilities
|
||||||
// if (!was_maximized_) Unmaximize();
|
SetMaximizable(was_maximizable_);
|
||||||
if (was_minimizable_) SetMinimizable(true);
|
SetMovable(was_movable_);
|
||||||
if (was_maximizable_) SetMaximizable(true);
|
|
||||||
if (was_resizable_) SetResizable(true);
|
|
||||||
if (was_movable_) SetMovable(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue