mirror of
https://github.com/yawut/SDL.git
synced 2026-08-27 11:14:13 -05:00
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.)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user