cocoa: GL_GetDrawableSize only uses -[NSView convertRectToBacking] for highDPI. SDL-ryan-batching-renderer
authorRyan C. Gordon <icculus@icculus.org>
Thu, 18 Oct 2018 11:59:48 -0400
branchSDL-ryan-batching-renderer
changeset 12350b1a820d2f1aa
parent 12349 a67dedb293c8
child 12351 3c003852825a
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.
(transplanted from a02aa66a76d84f7cb4181125c926e978b2284a57)
src/video/cocoa/SDL_cocoaopengl.m
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Mon Oct 22 20:50:32 2018 -0400
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Thu Oct 18 11:59:48 2018 -0400
     1.3 @@ -347,10 +347,12 @@
     1.4      NSView *contentView = [windata->nswindow contentView];
     1.5      NSRect viewport = [contentView bounds];
     1.6  
     1.7 -    /* This gives us the correct viewport for a Retina-enabled view, only
     1.8 -     * supported on 10.7+. */
     1.9 -    if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
    1.10 -        viewport = [contentView convertRectToBacking:viewport];
    1.11 +    if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
    1.12 +        /* This gives us the correct viewport for a Retina-enabled view, only
    1.13 +         * supported on 10.7+. */
    1.14 +        if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
    1.15 +            viewport = [contentView convertRectToBacking:viewport];
    1.16 +        }
    1.17      }
    1.18  
    1.19      if (w) {