diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 2042d07e1..88f6d7e79 100755 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -115,6 +115,7 @@ static SDL_VideoDevice *_this = NULL; #ifdef __MACOSX__ /* Support for Mac OS X fullscreen spaces */ +extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window * window); extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state); #endif @@ -2152,19 +2153,17 @@ SDL_OnWindowFocusGained(SDL_Window * window) static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window * window) { - SDL_bool default_minimize; const char *hint; if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { return SDL_FALSE; } - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { - /* We're not doing a mode switch, so it's okay to stay around */ - default_minimize = SDL_FALSE; - } else { - default_minimize = SDL_TRUE; +#ifdef __MACOSX__ + if (Cocoa_IsWindowInFullscreenSpace(window)) { + return SDL_FALSE; } +#endif hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS); if (hint) { @@ -2175,7 +2174,7 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window) } } - return default_minimize; + return SDL_TRUE; } void diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 182e634e5..4c1f359b3 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1382,6 +1382,18 @@ Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) } } +SDL_bool +Cocoa_IsWindowInFullscreenSpace(SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + if ([data->listener isInFullscreenSpace]) { + return SDL_TRUE; + } else { + return SDL_FALSE; + } +} + SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) {