Fixed building on macOS with OpenGL disabled

Fixes https://github.com/libsdl-org/SDL/issues/6226
This commit is contained in:
Sam Lantinga 2024-08-01 13:57:26 -07:00
parent 7fdf794377
commit 0b6eff4167
1 changed files with 3 additions and 2 deletions

View File

@ -933,11 +933,13 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
- (void)windowDidChangeScreen:(NSNotification *)aNotification - (void)windowDidChangeScreen:(NSNotification *)aNotification
{ {
/*printf("WINDOWDIDCHANGESCREEN\n");*/ /*printf("WINDOWDIDCHANGESCREEN\n");*/
#ifdef SDL_VIDEO_OPENGL
if (_data && _data.nscontexts) { if (_data && _data.nscontexts) {
for (SDLOpenGLContext *context in _data.nscontexts) { for (SDLOpenGLContext *context in _data.nscontexts) {
[context movedToNewScreen]; [context movedToNewScreen];
} }
} }
#endif /* SDL_VIDEO_OPENGL */
} }
- (void)windowWillEnterFullScreen:(NSNotification *)aNotification - (void)windowWillEnterFullScreen:(NSNotification *)aNotification
@ -2346,7 +2348,6 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata);
if (data) { if (data) {
NSArray *contexts;
if ([data.listener isInFullscreenSpace]) { if ([data.listener isInFullscreenSpace]) {
[NSMenu setMenuBarVisible:YES]; [NSMenu setMenuBarVisible:YES];
} }
@ -2360,7 +2361,7 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL
contexts = [data.nscontexts copy]; NSArray *contexts = [data.nscontexts copy];
for (SDLOpenGLContext *context in contexts) { for (SDLOpenGLContext *context in contexts) {
/* Calling setWindow:NULL causes the context to remove itself from the context list. */ /* Calling setWindow:NULL causes the context to remove itself from the context list. */
[context setWindow:NULL]; [context setWindow:NULL];