Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Improve maximized and non-resizable modes handling. #69380

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions platform/macos/display_server_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)]) {
Expand Down Expand Up @@ -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: {
Expand Down