From df73cae2b0da53e14668db97cea1ac083a9d5d38 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 19 Nov 2024 19:22:24 -0500
Subject: [PATCH] cocoa: Clear the pending flags on non-spaces fullscreen
transitions
Transitions to or from a non-spaces fullscreen state are synchronous, so clear both the enter and leave pending flags when changing the state.
---
src/video/cocoa/SDL_cocoawindow.m | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 31ec96e51d408..30d648f52a264 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -2741,7 +2741,8 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo
NSWindow *nswindow = data.nswindow;
NSRect rect;
- [data.listener clearPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN];
+ // This is a synchronous operation, so always clear the pending flags.
+ [data.listener clearPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN];
// The view responder chain gets messed with during setStyleMask
if ([data.sdlContentView nextResponder] == data.listener) {