src/video/cocoa/SDL_cocoawindow.m
changeset 7534 f0f5143b27cf
parent 7507 885b4aab4190
child 7535 c515121a3df7
equal deleted inserted replaced
7533:8f4447da4cfd 7534:f0f5143b27cf
   129 - (void)close
   129 - (void)close
   130 {
   130 {
   131     NSNotificationCenter *center;
   131     NSNotificationCenter *center;
   132     NSWindow *window = _data->nswindow;
   132     NSWindow *window = _data->nswindow;
   133     NSView *view = [window contentView];
   133     NSView *view = [window contentView];
       
   134     NSArray *windows = nil;
   134 
   135 
   135     center = [NSNotificationCenter defaultCenter];
   136     center = [NSNotificationCenter defaultCenter];
   136 
   137 
   137     if ([window delegate] != self) {
   138     if ([window delegate] != self) {
   138         [center removeObserver:self name:NSWindowDidExposeNotification object:window];
   139         [center removeObserver:self name:NSWindowDidExposeNotification object:window];
   152     if ([window nextResponder] == self) {
   153     if ([window nextResponder] == self) {
   153         [window setNextResponder:nil];
   154         [window setNextResponder:nil];
   154     }
   155     }
   155     if ([view nextResponder] == self) {
   156     if ([view nextResponder] == self) {
   156         [view setNextResponder:nil];
   157         [view setNextResponder:nil];
       
   158     }
       
   159 
       
   160     /* Make the next window in the z-order Key. If we weren't the foreground
       
   161        when closed, this is a no-op. */
       
   162     windows = [NSApp orderedWindows];
       
   163     if ([windows count] > 0) {
       
   164         NSWindow *win = (NSWindow *) [windows objectAtIndex:0];
       
   165         [win makeKeyAndOrderFront:self];
   157     }
   166     }
   158 }
   167 }
   159 
   168 
   160 - (BOOL)windowShouldClose:(id)sender
   169 - (BOOL)windowShouldClose:(id)sender
   161 {
   170 {