Merge pull request #27490 from bruvzg/macos_non_resizable_fullscreen

Allow non-resizeable windows to enter full-screen mode.
This commit is contained in:
Rémi Verschelde 2019-04-09 12:30:17 +02:00 committed by GitHub
commit 846e7bbc53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -271,6 +271,8 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
- (void)windowDidExitFullScreen:(NSNotification *)notification { - (void)windowDidExitFullScreen:(NSNotification *)notification {
OS_OSX::singleton->zoomed = false; OS_OSX::singleton->zoomed = false;
if (!OS_OSX::singleton->resizable)
[OS_OSX::singleton->window_object setStyleMask:[OS_OSX::singleton->window_object styleMask] & ~NSWindowStyleMaskResizable];
} }
- (void)windowDidChangeBackingProperties:(NSNotification *)notification { - (void)windowDidChangeBackingProperties:(NSNotification *)notification {
@ -2300,6 +2302,8 @@ void OS_OSX::set_window_fullscreen(bool p_enabled) {
if (zoomed != p_enabled) { if (zoomed != p_enabled) {
if (layered_window) if (layered_window)
set_window_per_pixel_transparency_enabled(false); set_window_per_pixel_transparency_enabled(false);
if (!resizable)
[window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];
[window_object toggleFullScreen:nil]; [window_object toggleFullScreen:nil];
} }
zoomed = p_enabled; zoomed = p_enabled;
@ -2314,7 +2318,7 @@ void OS_OSX::set_window_resizable(bool p_enabled) {
if (p_enabled) if (p_enabled)
[window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable]; [window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];
else else if (!zoomed)
[window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable]; [window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable];
resizable = p_enabled; resizable = p_enabled;