瀏覽代碼

Check NSWindow::isVisible before sending SDL_WINDOWEVENT_RESTORED during Cocoa_WindowListener::windowDidResize

(cherry picked from commit e610529e84688b556f008e14e3eb81f771aa86bf)
Dan Andrus 1 月之前
父節點
當前提交
f8119d4760
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/video/cocoa/SDL_cocoawindow.m

+ 5 - 0
src/video/cocoa/SDL_cocoawindow.m

@@ -855,6 +855,11 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
 
+    /* The OS can resize the window automatically if the display density
+       changes while the window is miniaturized or hidden */
+    if (![nswindow isVisible])
+        return;
+
     /* isZoomed always returns true if the window is not resizable */
     if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
         zoomed = YES;