diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index a8de968b7..b30cefe2c 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -784,8 +784,12 @@ - (void)windowDidExitFullScreen:(NSNotification *)aNotification inFullscreenTransition = NO; SetWindowStyle(window, GetWindowStyle(window)); - - [nswindow setLevel:kCGNormalWindowLevel]; + + if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + [nswindow setLevel:NSFloatingWindowLevel]; + } else { + [nswindow setLevel:kCGNormalWindowLevel]; + } if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) { pendingWindowOperation = PENDING_OPERATION_NONE; @@ -1456,6 +1460,10 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent } } + if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + [nswindow setLevel:NSFloatingWindowLevel]; + } + /* Create a default view for this window */ rect = [nswindow contentRectForFrameRect:[nswindow frame]]; SDLView *contentView = [[SDLView alloc] initWithFrame:rect]; @@ -1795,6 +1803,8 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent if (SDL_ShouldAllowTopmost() && fullscreen) { /* OpenGL is rendering to the window, so make it visible! */ [nswindow setLevel:CGShieldingWindowLevel()]; + } else if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + [nswindow setLevel:NSFloatingWindowLevel]; } else { [nswindow setLevel:kCGNormalWindowLevel]; } @@ -1888,6 +1898,8 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent /* OpenGL is rendering to the window, so make it visible! */ /* Doing this in 10.11 while in a Space breaks things (bug #3152) */ [data->nswindow setLevel:CGShieldingWindowLevel()]; + } else if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + [data->nswindow setLevel:NSFloatingWindowLevel]; } else { [data->nswindow setLevel:kCGNormalWindowLevel]; }