From 1a9801a16f003ee2df56dc56f35e8d5d08ad6c70 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 14 Jul 2026 22:10:12 -0400 Subject: [PATCH] cocoa: Clear state on failure to enter fullscreen A fullscreen exit event doesn't always accompany an entry error, so ensure that all relevant state is cleared if the window fails to enter fullscreen. --- src/video/cocoa/SDL_cocoawindow.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index a878267802..ac0d904d47 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1430,12 +1430,18 @@ static NSCursor *Cocoa_GetDesiredCursor(void) } /* This is usually sent after an unexpected windowDidExitFullscreen if the window - * failed to become fullscreen. + * failed to become fullscreen, but not always, so ensure that the state variables + * are cleared. * * Since something went wrong and the current state is unknown, dump any pending events. + * + * For testing purposes, this error can usually be induced by starting something that + * immedately enters a fullscreen space from a terminal that is in a fullscreen space. */ - (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification { + inFullscreenTransition = NO; + isFullscreenSpace = NO; [self clearAllPendingWindowOperations]; }