From 3905b910f3f9bf8678eafcc6b69c1134e5d25b71 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 2 Jun 2014 09:01:10 -0700 Subject: [PATCH] Fixed bug 2479 - [OS X] SDL_SetWindowFullscreen fails to switch to windowed Eric Wasylishen The problem seems to be the spaces handling code in -setFullscreenSpace: (SDL_cocoawindow.m) is incorrectly reporting that the SDL_WINDOW_FULLSCREEN -> windowed transition has already happened. i.e. I saw this case was getting hit when trying to leave SDL_WINDOW_FULLSCREEN: "else if (state == isFullscreenSpace) { return YES; /* already there. */ }" With the attached patch, both Control+Enter (SDL_WINDOW_FULLSCREEN toggle) and Option+Enter (SDL_WINDOW_FULLSCREEN_DESKTOP toggle) work in an sdl test app (I tried testwm2). Tested on OS X 10.9.2. --- src/video/cocoa/SDL_cocoawindow.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index ba3059789..eca68a59f 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -268,6 +268,8 @@ SetWindowStyle(SDL_Window * window, unsigned int style) return NO; /* Spaces are forcibly disabled. */ } else if (state && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) { return NO; /* we only allow you to make a Space on FULLSCREEN_DESKTOP windows. */ + } else if (!state && ((window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) { + return NO; /* we only handle leaving the Space on windows that were previously FULLSCREEN_DESKTOP. */ } else if (state == isFullscreenSpace) { return YES; /* already there. */ }