From 31be8ae8e959e20574b14ff5baf2eb2d53c5cb84 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 24 May 2021 10:47:36 +0300 Subject: [PATCH] [macOS] Allow "on top" windows to enter full-screen mode. --- platform/osx/os_osx.mm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index cdc9d0e84a93..0b999163ba0c 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -322,6 +322,9 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { if (!OS_OSX::singleton->resizable) [OS_OSX::singleton->window_object setStyleMask:[OS_OSX::singleton->window_object styleMask] & ~NSWindowStyleMaskResizable]; + + if (OS_OSX::singleton->on_top) + [OS_OSX::singleton->window_object setLevel:NSFloatingWindowLevel]; } - (void)windowDidChangeBackingProperties:(NSNotification *)notification { @@ -1688,7 +1691,7 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay } on_top = p_desired.always_on_top; - if (p_desired.always_on_top) { + if (p_desired.always_on_top && !p_desired.fullscreen) { [window_object setLevel:NSFloatingWindowLevel]; } @@ -2553,7 +2556,7 @@ static int get_screen_index(NSScreen *screen) { [window_object setHidesOnDeactivate:YES]; } else { // Reset these when our window is not a borderless window that covers up the screen - if (on_top) { + if (on_top & !zoomed) { [window_object setLevel:NSFloatingWindowLevel]; } else { [window_object setLevel:NSNormalWindowLevel]; @@ -2725,6 +2728,7 @@ static int get_screen_index(NSScreen *screen) { } if (zoomed != p_enabled) { + [window_object setLevel:NSNormalWindowLevel]; if (layered_window) set_window_per_pixel_transparency_enabled(false); if (!resizable) @@ -2822,6 +2826,9 @@ static int get_screen_index(NSScreen *screen) { on_top = p_enabled; + if (zoomed) + return; + if (is_window_always_on_top() == p_enabled) return; @@ -2832,7 +2839,11 @@ static int get_screen_index(NSScreen *screen) { } bool OS_OSX::is_window_always_on_top() const { - return [window_object level] == NSFloatingWindowLevel; + if (zoomed) { + return on_top; + } else { + return [window_object level] == NSFloatingWindowLevel; + } } bool OS_OSX::is_window_focused() const {