Commit 031348d377dad25573f7cce1ee1c9385df1b05a7

Sam Lantinga 2023-02-28T09:02:01

Fixed SDL windows getting the maximized state after leaving fullscreen on macOS (cherry picked from commit 2df08fb1b27b721998a1380a2acdbe1494b5591e)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index a6d8ebf..634f855 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -817,7 +817,12 @@ Cocoa_UpdateClipCursor(SDL_Window * window)
     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
 
-    zoomed = [nswindow isZoomed];
+    /* isZoomed always returns true if the window is not resizable */
+    if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
+        zoomed = YES;
+    } else {
+        zoomed = NO;
+    }
     if (!zoomed) {
         SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
     } else if (zoomed) {