From 9cd2e9ec8fc0127393dfce9c0359d500c8c238be Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 09 Apr 2019 02:22:50 +0000
Subject: [PATCH] updae source to 2.0.9 source
---
source/src/video/cocoa/SDL_cocoaopengl.m | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/source/src/video/cocoa/SDL_cocoaopengl.m b/source/src/video/cocoa/SDL_cocoaopengl.m
index 5f18a2e..9539c17 100644
--- a/source/src/video/cocoa/SDL_cocoaopengl.m
+++ b/source/src/video/cocoa/SDL_cocoaopengl.m
@@ -347,10 +347,12 @@
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) {
@@ -408,8 +410,14 @@
{ @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;
}}
--
Gitblit v1.9.3