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] Allow "on top" windows to enter full-screen mode. #49016

Merged
merged 1 commit into from
May 24, 2021
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
16 changes: 14 additions & 2 deletions platform/osx/display_server_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification {
if (wd.resize_disabled) {
[wd.window_object setStyleMask:[wd.window_object styleMask] & ~NSWindowStyleMaskResizable];
}

if (wd.on_top) {
[wd.window_object setLevel:NSFloatingWindowLevel];
}
}

- (void)windowDidChangeBackingProperties:(NSNotification *)notification {
Expand Down Expand Up @@ -2437,7 +2441,7 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
[p_wd.window_object setHidesOnDeactivate:YES];
} else {
// Reset these when our window is not a borderless window that covers up the screen
if (p_wd.on_top) {
if (p_wd.on_top && !p_wd.fullscreen) {
[p_wd.window_object setLevel:NSFloatingWindowLevel];
} else {
[p_wd.window_object setLevel:NSNormalWindowLevel];
Expand Down Expand Up @@ -2786,6 +2790,7 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
[wd.window_object deminiaturize:nil];
} break;
case WINDOW_MODE_FULLSCREEN: {
[wd.window_object setLevel:NSNormalWindowLevel];
if (wd.layered_window) {
_set_window_per_pixel_transparency_enabled(true, p_window);
}
Expand Down Expand Up @@ -2903,6 +2908,9 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
wd.on_top = p_enabled;
if (wd.fullscreen) {
return;
}
if (p_enabled) {
[wd.window_object setLevel:NSFloatingWindowLevel];
} else {
Expand Down Expand Up @@ -2940,7 +2948,11 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
return [wd.window_object styleMask] == NSWindowStyleMaskBorderless;
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
return [wd.window_object level] == NSFloatingWindowLevel;
if (wd.fullscreen) {
return wd.on_top;
} else {
return [wd.window_object level] == NSFloatingWindowLevel;
}
} break;
case WINDOW_FLAG_TRANSPARENT: {
return wd.layered_window;
Expand Down