Skip to content

Commit

Permalink
Fixed macOS build
Browse files Browse the repository at this point in the history
(cherry picked from commit 230f1de)
  • Loading branch information
slouken committed Aug 1, 2024
1 parent a9b1198 commit dcbdf09
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/video/cocoa/SDL_cocoawindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -933,13 +933,13 @@ - (void)windowDidChangeScreenProfile:(NSNotification *)aNotification
- (void)windowDidChangeScreen:(NSNotification *)aNotification
{
/*printf("WINDOWDIDCHANGESCREEN\n");*/
#ifdef SDL_VIDEO_OPENGL
#ifdef SDL_VIDEO_OPENGL
if (_data && _data.nscontexts) {
for (SDLOpenGLContext *context in _data.nscontexts) {
[context movedToNewScreen];
}
}
#endif /* SDL_VIDEO_OPENGL */
#endif /* SDL_VIDEO_OPENGL */
}

- (void)windowWillEnterFullScreen:(NSNotification *)aNotification
Expand Down Expand Up @@ -2348,6 +2348,10 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata);

if (data) {
#ifdef SDL_VIDEO_OPENGL
NSArray *contexts;
#endif

if ([data.listener isInFullscreenSpace]) {
[NSMenu setMenuBarVisible:YES];
}
Expand All @@ -2359,15 +2363,13 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
[data.nswindow close];
}

#ifdef SDL_VIDEO_OPENGL

NSArray *contexts = [data.nscontexts copy];
#ifdef 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 */
#endif /* SDL_VIDEO_OPENGL */

if (window->shaper) {
CFBridgingRelease(window->shaper->driverdata);
Expand Down

0 comments on commit dcbdf09

Please sign in to comment.