From b69201daebfe0e7e0e59cd5fe0f4a24a07d5ae60 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 1 Mar 2025 22:43:40 -0500 Subject: [PATCH] cocoa: Don't overwrite the desktop mode when changing the fullscreen mode Changing the mode triggers a display reconfiguration event, which will overwrite the desktop mode with the set fullscreen mode, preventing proper restoration when leaving fullscreen. Don't overwrite the desktop mode if the reconfiguration is due to a fullscreen mode switch. --- src/video/cocoa/SDL_cocoamodes.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index b4e151b916..ceba83fb30 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -433,7 +433,7 @@ static void Cocoa_DisplayReconfigurationCallback(CGDirectDisplayID displayid, CG } } - if (flags & kCGDisplaySetModeFlag) { + if ((flags & kCGDisplaySetModeFlag) && !_this->setting_display_mode) { if (display) { CGDisplayModeRef moderef = CGDisplayCopyDisplayMode(displayid); if (moderef) {