Browse Source

cocoa: Fix minimizing fullscreen windows on Sequoia

Sequoia seems to require that the window briefly be made key when minimizing it after coming out of fullscreen.
Frank Praznik 5 months ago
parent
commit
014196d98d
1 changed files with 9 additions and 7 deletions
  1. 9 7
      src/video/cocoa/SDL_cocoawindow.m

+ 9 - 7
src/video/cocoa/SDL_cocoawindow.m

@@ -2801,14 +2801,7 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo
         // When the window style changes the title is cleared
         if (!fullscreen) {
             Cocoa_SetWindowTitle(_this, window);
-
             data.was_zoomed = NO;
-
-            if ([data.listener windowOperationIsPending:PENDING_OPERATION_MINIMIZE]) {
-                Cocoa_WaitForMiniaturizable(window);
-                [data.listener addPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN];
-                [nswindow miniaturize:nil];
-            }
         }
 
         if (SDL_ShouldAllowTopmost() && fullscreen) {
@@ -2842,6 +2835,15 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo
             }
         }
 
+        /* When coming out of fullscreen to minimize, this needs to happen after the window
+         * is made key again, or it won't minimize on 15.0 (Sequoia).
+         */
+        if (!fullscreen && [data.listener windowOperationIsPending:PENDING_OPERATION_MINIMIZE]) {
+            Cocoa_WaitForMiniaturizable(window);
+            [data.listener addPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN];
+            [nswindow miniaturize:nil];
+        }
+
         ScheduleContextUpdates(data);
     }