Sfoglia il codice sorgente

cocoa: GL_GetDrawableSize only uses -[NSView convertRectToBacking] for highDPI.

On Mojave, this will report large numbers for retina displays in fullscreen
mode, which isn't how it works on previous versions.
Ryan C. Gordon 6 anni fa
parent
commit
eac3fd28d8
1 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 6 4
      src/video/cocoa/SDL_cocoaopengl.m

+ 6 - 4
src/video/cocoa/SDL_cocoaopengl.m

@@ -347,10 +347,12 @@ Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
     NSView *contentView = [windata->nswindow contentView];
     NSRect viewport = [contentView bounds];
 
-    /* This gives us the correct viewport for a Retina-enabled view, only
-     * supported on 10.7+. */
-    if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
-        viewport = [contentView convertRectToBacking:viewport];
+    if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+        /* This gives us the correct viewport for a Retina-enabled view, only
+         * supported on 10.7+. */
+        if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
+            viewport = [contentView convertRectToBacking:viewport];
+        }
     }
 
     if (w) {