diff --git a/ChangeLog b/ChangeLog index cfae8fbaa..d0c7c6c45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-09-19 Matt Rice + + * Source/NSApplication.m ([NSApplication -targetForAction:]): Check + document of a document-based app before key window. + * Source/NSWindow.m ([NSWindow -performClose:]): Close the + document not self if there is a document associated with this window. + 2003-09-19 Adam Fedor * Headers/Additions/GNUstepGUI/GSMethodTable.h: Change NSReadPixel diff --git a/Source/NSApplication.m b/Source/NSApplication.m index d9b669c13..204b74192 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1649,6 +1649,18 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException)); } resp = [resp nextResponder]; } + + if ([NSDocumentController isDocumentBasedApplication]) + { + resp = [[NSDocumentController sharedDocumentController] + documentForWindow: keyWindow]; + + if (resp != nil && [resp respondsToSelector: aSelector]) + { + return resp; + } + } + if ([keyWindow respondsToSelector: aSelector]) { return keyWindow; @@ -1659,17 +1671,6 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException)); { return resp; } - - if ([NSDocumentController isDocumentBasedApplication]) - { - resp = [[NSDocumentController sharedDocumentController] - documentForWindow: keyWindow]; - - if (resp != nil && [resp respondsToSelector: aSelector]) - { - return resp; - } - } } if (_session != 0) diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 92119e058..190f9c1ae 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2304,6 +2304,8 @@ resetCursorRectsForView(NSView *theView) - (void) performClose: (id)sender { + NSDocument *document = [_windowController document]; + /* Don't close if a modal session is running and we are not the modal window */ if ([NSApp modalWindow] && self != [NSApp modalWindow]) @@ -2318,8 +2320,6 @@ resetCursorRectsForView(NSView *theView) if (_windowController) { - NSDocument *document = [_windowController document]; - if (document && ![document shouldCloseWindowController: _windowController]) { NSBeep(); @@ -2355,7 +2355,14 @@ resetCursorRectsForView(NSView *theView) } // FIXME: The button should be highlighted - [self close]; + if (document) + { + [document close]; + } + else + { + [self close]; + } } - (BOOL) performKeyEquivalent: (NSEvent*)theEvent