macOS: Fix non-highdpi OpenGL contexts not scaling properly in macOS 10.15 (bug 4810 and 4822).
authorAlex Szpakowski <slime73@gmail.com>
Sun, 13 Oct 2019 21:39:20 -0300
changeset 1311546b094f7d20e
parent 13114 3276502021a5
child 13116 065b94926987
macOS: Fix non-highdpi OpenGL contexts not scaling properly in macOS 10.15 (bug 4810 and 4822).
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sun Oct 13 20:52:52 2019 +0200
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sun Oct 13 21:39:20 2019 -0300
     1.3 @@ -1486,10 +1486,11 @@
     1.4      #pragma clang diagnostic push
     1.5      #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     1.6      #endif
     1.7 -    if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
     1.8 -        if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
     1.9 -            [contentView setWantsBestResolutionOpenGLSurface:YES];
    1.10 -        }
    1.11 +    /* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when
    1.12 +     * the NSHighResolutionCapable boolean is set in Info.plist. */
    1.13 +    if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
    1.14 +        BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
    1.15 +        [contentView setWantsBestResolutionOpenGLSurface:highdpi];
    1.16      }
    1.17      #ifdef __clang__
    1.18      #pragma clang diagnostic pop