# HG changeset patch # User Ryan C. Gordon # Date 1374540907 14400 # Node ID a3c4494f54202fc1ff847ab6494ee37e20fc8a48 # Parent 6b484ff38f86a8250f348e787600355c8ed45f30 Cocoa: Make the next-highest window gain focus when a window is closing. (if the closed window wasn't the foreground, this is effectively a no-op.) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -133,6 +133,7 @@ NSNotificationCenter *center; NSWindow *window = _data->nswindow; NSView *view = [window contentView]; + NSArray *windows = nil; center = [NSNotificationCenter defaultCenter]; @@ -157,6 +158,12 @@ if ([view nextResponder] == self) { [view setNextResponder:nil]; } + + windows = [NSApp orderedWindows]; + if ([windows count] > 0) { + NSWindow *win = (NSWindow *) [windows objectAtIndex:0]; + [win makeKeyAndOrderFront:self]; + } } - (BOOL)windowShouldClose:(id)sender