From 8cd08f8b6f95d968f15a263c7187cb747a3c1459 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 30 Nov 2022 11:34:40 +0200 Subject: [PATCH] [macOS] Improve maximized and non-resizable modes handling. --- platform/macos/display_server_macos.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index a3bee13f69f2..ad6143e16ebd 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -2420,7 +2420,7 @@ ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if ([wd.window_object isZoomed]) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { return; } @@ -2543,7 +2543,7 @@ ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if ([wd.window_object isZoomed]) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { return; } @@ -2625,7 +2625,7 @@ wd.exclusive_fullscreen = false; } break; case WINDOW_MODE_MAXIMIZED: { - if ([wd.window_object isZoomed]) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { [wd.window_object zoom:nil]; } } break; @@ -2658,7 +2658,7 @@ } } break; case WINDOW_MODE_MAXIMIZED: { - if (![wd.window_object isZoomed]) { + if (!NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { [wd.window_object zoom:nil]; } } break; @@ -2678,7 +2678,7 @@ return WINDOW_MODE_FULLSCREEN; } } - if ([wd.window_object isZoomed] && !wd.resize_disabled) { + if (NSEqualRects([wd.window_object frame], [[wd.window_object screen] visibleFrame])) { return WINDOW_MODE_MAXIMIZED; } if ([wd.window_object respondsToSelector:@selector(isMiniaturized)]) { @@ -2788,8 +2788,10 @@ } if (p_enabled) { [wd.window_object setStyleMask:[wd.window_object styleMask] & ~NSWindowStyleMaskResizable]; + [[wd.window_object standardWindowButton:NSWindowZoomButton] setEnabled:NO]; } else { [wd.window_object setStyleMask:[wd.window_object styleMask] | NSWindowStyleMaskResizable]; + [[wd.window_object standardWindowButton:NSWindowZoomButton] setEnabled:YES]; } } break; case WINDOW_FLAG_EXTEND_TO_TITLE: {