diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index cf6290cd50..560f2ddd39 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1203,6 +1203,14 @@ static NSCursor *Cocoa_GetDesiredCursor(void) _data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; SDL_ToggleModState(SDL_KMOD_CAPS, newflags ? true : false); } + + /* Restore fullscreen mode unless the window is deminiaturizing. + * If it is, fullscreen will be restored when deminiaturization is complete. + */ + if (!(window->flags & SDL_WINDOW_MINIMIZED) && + [self windowOperationIsPending:PENDING_OPERATION_ENTER_FULLSCREEN]) { + SDL_UpdateFullscreenMode(window, true, true); + } } - (void)windowDidResignKey:(NSNotification *)aNotification @@ -2733,6 +2741,8 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo NSWindow *nswindow = data.nswindow; NSRect rect; + [data.listener clearPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN]; + // The view responder chain gets messed with during setStyleMask if ([data.sdlContentView nextResponder] == data.listener) { [data.sdlContentView setNextResponder:nil]; @@ -2841,6 +2851,7 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo if (!fullscreen && [data.listener windowOperationIsPending:PENDING_OPERATION_MINIMIZE]) { Cocoa_WaitForMiniaturizable(window); [data.listener addPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN]; + [data.listener clearPendingWindowOperation:PENDING_OPERATION_MINIMIZE]; [nswindow miniaturize:nil]; }