From 5e654a4bf28f30795f10727df7bec133dde8dfc0 Mon Sep 17 00:00:00 2001
From: Aaron Barany <[EMAIL REDACTED]>
Date: Sat, 1 Oct 2022 16:10:46 -0700
Subject: [PATCH] Fixed Mac compile errors when OpenGL is disabled.
---
src/video/cocoa/SDL_cocoawindow.m | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 02c01bdce1c..fa0096857cf 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -267,6 +267,8 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
}
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
+ #if SDL_VIDEO_OPENGL
+
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -287,6 +289,8 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
+
+ #endif /* SDL_VIDEO_OPENGL */
}
/* !!! FIXME: this should use a hint callback. */
@@ -2350,11 +2354,15 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
[data.nswindow close];
}
+ #if SDL_VIDEO_OPENGL
+
contexts = [data.nscontexts copy];
for (SDLOpenGLContext *context in contexts) {
/* Calling setWindow:NULL causes the context to remove itself from the context list. */
[context setWindow:NULL];
}
+
+ #endif /* SDL_VIDEO_OPENGL */
}
window->driverdata = NULL;
}}