| | |
| | | NSView *contentView = [windata->nswindow contentView]; |
| | | NSRect viewport = [contentView bounds]; |
| | | |
| | | 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) { |
| | |
| | | { @autoreleasepool |
| | | { |
| | | SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); |
| | | SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
| | | |
| | | /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two |
| | | threads try to swap at the same time, so put a mutex around it. */ |
| | | SDL_LockMutex(videodata->swaplock); |
| | | [nscontext flushBuffer]; |
| | | [nscontext updateIfNeeded]; |
| | | SDL_UnlockMutex(videodata->swaplock); |
| | | return 0; |
| | | }} |
| | | |