Skip to content

Commit

Permalink
Fixed bug 5098 - macOS CreateWindowFrom doesn't work with high-dpi di…
Browse files Browse the repository at this point in the history
…splays

michaeljosephmaltese

Display ends up taking only 1/4 of the screen area. It needs to call "setWantsBestResolutionOpenGLSurface:highdpi", like when creating a window the normal way.
  • Loading branch information
slouken committed May 11, 2020
1 parent eadc869 commit b47f577
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -1588,6 +1588,21 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
window->title = SDL_strdup([title UTF8String]);
}

/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
/* 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 ([nsview respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
[nsview setWantsBestResolutionOpenGLSurface:highdpi];
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

return SetupWindowData(_this, window, nswindow, nsview, SDL_FALSE);
}}

Expand Down

0 comments on commit b47f577

Please sign in to comment.