Skip to content

Commit

Permalink
cocoa: GL_GetDrawableSize only uses -[NSView convertRectToBacking] fo…
Browse files Browse the repository at this point in the history
…r highDPI.

On Mojave, this will report large numbers for retina displays in fullscreen
mode, which isn't how it works on previous versions.
  • Loading branch information
icculus committed Oct 18, 2018
1 parent 4db5e87 commit eac3fd2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/video/cocoa/SDL_cocoaopengl.m
Expand Up @@ -347,10 +347,12 @@ - (void)setWindow:(SDL_Window *)newWindow
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) {
Expand Down

0 comments on commit eac3fd2

Please sign in to comment.