We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3152

Summary: OS X 10.11 Cmd-Tab not returning to space in SDL_WINDOW_FULLSCREEN_DESKTOP
Product: SDL Reporter: Dan Ginsburg <dang>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amaranth72
Version: HG 2.1   
Hardware: x86_64   
OS: Mac OS X (All)   

Description Dan Ginsburg 2015-10-15 16:50:47 UTC
On OS X 10.11 (although not OS X 10.10), when a window is put into SDL_WINDOW_FULLSCREEN_DESKTOP it will create the window in a new space as it should.  However, if you Command-Tab out of that window and Command-Tab back, the dock will hide but it will not return to the Space.  You can get back to the Space with CTRL->RIGHT or swiping, but users in Dota 2 get confused by this.

Reproducing this is super easy, I modified testgl2.c to show the bug.  Simply modify testgl2.c to go SDL_WINDOW_FULLSCREEN_DESTKOP as in the code below, then run the app, Command-Tab to the desktop, Command-Tab back to the app and you will see the dock clear but it won't return to the app.

This seems to be some sort of behavior change with OS X 10.11 because it doesn't happen in OS X 10.10.

diff -r d3ad01d50bf0 test/testgl2.c
--- a/test/testgl2.c	Wed Oct 07 21:18:08 2015 +0200
+++ b/test/testgl2.c	Thu Oct 15 12:44:35 2015 -0400
@@ -362,6 +362,10 @@
         }
     }
 
+    //@TEMP
+    SDL_SetWindowFullscreen( state->windows[0], SDL_WINDOW_FULLSCREEN_DESKTOP );
+    //@TEMP
+
     /* Set rendering settings */
     ctx.glMatrixMode(GL_PROJECTION);
     ctx.glLoadIdentity();
Comment 1 Dan Ginsburg 2015-10-15 16:58:55 UTC
Cross-reference to Dota 2 bug: https://github.com/ValveSoftware/Dota-2/issues/546
Comment 2 Alex Szpakowski 2015-10-16 03:51:54 UTC
This seems to be fixed if the Cocoa code stops trying to set the window level to anything above the 'normal' window level when fullscreen-desktop mode is used.

( https://hg.libsdl.org/SDL/file/b0b12a3c817c/src/video/cocoa/SDL_cocoawindow.m#l1519 , and https://hg.libsdl.org/SDL/file/b0b12a3c817c/src/video/cocoa/SDL_cocoawindow.m#l1604 )

That said, the last time I tried fiddling with what SDL sets the window level to in fullscreen, there were some performance implications. But I think that was before SDL used Spaces for fullscreen-desktop mode, so the performance implications (if any) likely aren't the same now.
Comment 3 Alex Szpakowski 2015-10-23 06:38:56 UTC
This should be fixed as of this commit: https://hg.libsdl.org/SDL/rev/b9b4c1bbb778
Comment 4 Dan Ginsburg 2015-10-27 18:29:00 UTC
Thanks Alex!  I can confirm this fixed the issue for Dota 2.