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.) --HG-- extra : rebase_source : e87546ce8bcfc1b3e21631b8ef6a1264d3f499d6
This commit is contained in:
parent
41edaa9b20
commit
0c7cb878bd
1 changed files with 9 additions and 0 deletions
|
@ -131,6 +131,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
|||
NSNotificationCenter *center;
|
||||
NSWindow *window = _data->nswindow;
|
||||
NSView *view = [window contentView];
|
||||
NSArray *windows = nil;
|
||||
|
||||
center = [NSNotificationCenter defaultCenter];
|
||||
|
||||
|
@ -155,6 +156,14 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue