From 009226c61e4637c57d5e0bea3ca86866da5651fb Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 13 Oct 2019 21:39:20 -0300 Subject: [PATCH] macOS: Fix non-highdpi OpenGL contexts not scaling properly in macOS 10.15 (bug 4810 and 4822). --- src/video/cocoa/SDL_cocoawindow.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 607a63a750345..a141e8661c6ed 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1486,10 +1486,11 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif - if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { - [contentView setWantsBestResolutionOpenGLSurface:YES]; - } + /* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when + * the NSHighResolutionCapable boolean is set in Info.plist. */ + if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { + BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; + [contentView setWantsBestResolutionOpenGLSurface:highdpi]; } #ifdef __clang__ #pragma clang diagnostic pop