From 65133ebc1b556406715e83415c3f67cca031dfd5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 4 Jun 2014 09:39:08 -0700 Subject: [PATCH] Wait for the fullscreen transition to complete before allowing the application to continue. This fixes Alt-Enter in the Steam streaming client, which sets the window size and position immediately after switching out of fullscreen mode. --- src/video/cocoa/SDL_cocoawindow.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 0132124c3aa66..71f7bb67be44c 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1544,6 +1544,20 @@ - (void)resetCursorRects if ([data->listener setFullscreenSpace:(state ? YES : NO)]) { succeeded = SDL_TRUE; + + /* Wait for the transition to complete, so application changes + take effect properly (e.g. setting the window size, etc.) + */ + const int limit = 10000; + int count = 0; + while ([data->listener isInFullscreenSpaceTransition]) { + if ( ++count == limit ) { + /* Uh oh, transition isn't completing. Should we assert? */ + break; + } + SDL_Delay(1); + SDL_PumpEvents(); + } } [pool release];