From 6aeb07d4c205491c5935d77c8961247162f17729 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 28 Feb 2023 09:02:01 -0800
Subject: [PATCH] Fixed SDL windows getting the maximized state after leaving
fullscreen on macOS
---
src/video/cocoa/SDL_cocoawindow.m | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index b14cd3bbf623..fb4665fb48ee 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -811,7 +811,12 @@ - (void)windowDidResize:(NSNotification *)aNotification
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_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_EVENT_WINDOW_RESTORED, 0, 0);
} else if (zoomed) {