Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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.)
  • Loading branch information
icculus committed Jul 23, 2013
1 parent ef3be01 commit 5c27dc74b7421ff9afd54201c2e2dfccaab1a44b
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/video/cocoa/SDL_cocoawindow.m
@@ -131,6 +131,7 @@ - (void)close
NSNotificationCenter *center;
NSWindow *window = _data->nswindow;
NSView *view = [window contentView];
NSArray *windows = nil;

center = [NSNotificationCenter defaultCenter];

@@ -155,6 +156,14 @@ - (void)close
if ([view nextResponder] == self) {
[view setNextResponder:nil];
}

/* Make the next window in the z-order Key. If we weren't the foreground
when closed, this is a no-op. */
windows = [NSApp orderedWindows];
if ([windows count] > 0) {
NSWindow *win = (NSWindow *) [windows objectAtIndex:0];
[win makeKeyAndOrderFront:self];
}
}

- (BOOL)windowShouldClose:(id)sender

0 comments on commit 5c27dc7

Please sign in to comment.