From 7ebdae5dc977b9605ae196bfafa9336b316c739a Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 16 Nov 2022 11:45:41 -0500
Subject: [PATCH] cocoa: Fix OpenGL deprecation warning.
---
src/video/cocoa/SDL_cocoawindow.m | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 05cdcbcbd41e..ddf2fc9f55f6 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -260,12 +260,6 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
static void
ScheduleContextUpdates(SDL_WindowData *data)
{
- NSOpenGLContext *currentContext;
- NSMutableArray *contexts;
- if (!data || !data.nscontexts) {
- return;
- }
-
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
#if SDL_VIDEO_OPENGL
@@ -274,6 +268,12 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
+ NSOpenGLContext *currentContext;
+ NSMutableArray *contexts;
+ if (!data || !data.nscontexts) {
+ return;
+ }
+
currentContext = [NSOpenGLContext currentContext];
contexts = data.nscontexts;
@synchronized (contexts) {