Commit f8824cb99b29334652952f6321ba938eb8e39daa

Alex Szpakowski 2015-10-23T03:37:53

Mac: Fix returning to the window's Space in OS X 10.11+ when SDL_WINDOW_FULLSCREEN_DESKTOP is used (bug #3152.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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];