From 0b6eff4167013efb614f8f7397ccd87261674eda Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Aug 2024 13:57:26 -0700 Subject: [PATCH] Fixed building on macOS with OpenGL disabled Fixes https://github.com/libsdl-org/SDL/issues/6226 --- src/video/cocoa/SDL_cocoawindow.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 828366095c..3ee230c42f 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -933,11 +933,13 @@ static NSCursor *Cocoa_GetDesiredCursor(void) - (void)windowDidChangeScreen:(NSNotification *)aNotification { /*printf("WINDOWDIDCHANGESCREEN\n");*/ + #ifdef SDL_VIDEO_OPENGL if (_data && _data.nscontexts) { for (SDLOpenGLContext *context in _data.nscontexts) { [context movedToNewScreen]; } } + #endif /* SDL_VIDEO_OPENGL */ } - (void)windowWillEnterFullScreen:(NSNotification *)aNotification @@ -2346,7 +2348,6 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window) SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); if (data) { - NSArray *contexts; if ([data.listener isInFullscreenSpace]) { [NSMenu setMenuBarVisible:YES]; } @@ -2360,7 +2361,7 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window) #ifdef SDL_VIDEO_OPENGL - contexts = [data.nscontexts copy]; + NSArray *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];