浏览代码

Fixed SDL windows getting the maximized state after leaving fullscreen on macOS

Sam Lantinga 2 年之前
父节点
当前提交
6aeb07d4c2
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/video/cocoa/SDL_cocoawindow.m

+ 6 - 1
src/video/cocoa/SDL_cocoawindow.m

@@ -811,7 +811,12 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
     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) {