Mac: Fix returning to the window's Space in OS X 10.11+ when SDL_WINDOW_FULLSCREEN_DESKTOP is used (bug #3152.)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 258c677..1ab5bac 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -1602,8 +1602,10 @@ Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
}
if ( data && (window->flags & SDL_WINDOW_FULLSCREEN) ) {
- if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
+ if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)
+ && ![data->listener isInFullscreenSpace]) {
/* 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 {
[data->nswindow setLevel:kCGNormalWindowLevel];