diff --git a/ChangeLog b/ChangeLog index d0c7c6c45..64d723940 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-09-20 Adam Fedor + + * Source/NSWindowController.m ([NSWindowController -setDocument:]): + Set window to releaseWhenClosed if document is not nil. + * Source/NSApplication.m ([NSApplication -targetForAction:]): Revert + last change. + * Source/NSWindow.m ([NSWindow -performClose:]): Idem. + 2003-09-19 Matt Rice * Source/NSApplication.m ([NSApplication -targetForAction:]): Check diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 204b74192..d9b669c13 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1649,18 +1649,6 @@ 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; @@ -1671,6 +1659,17 @@ 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 190f9c1ae..92119e058 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2304,8 +2304,6 @@ 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]) @@ -2320,6 +2318,8 @@ resetCursorRectsForView(NSView *theView) if (_windowController) { + NSDocument *document = [_windowController document]; + if (document && ![document shouldCloseWindowController: _windowController]) { NSBeep(); @@ -2355,14 +2355,7 @@ resetCursorRectsForView(NSView *theView) } // FIXME: The button should be highlighted - if (document) - { - [document close]; - } - else - { - [self close]; - } + [self close]; } - (BOOL) performKeyEquivalent: (NSEvent*)theEvent diff --git a/Source/NSWindowController.m b/Source/NSWindowController.m index b9d86a1f5..cbfb0a53e 100644 --- a/Source/NSWindowController.m +++ b/Source/NSWindowController.m @@ -160,6 +160,8 @@ released. */ [_window setReleasedWhenClosed: NO]; } + else + [_window setReleasedWhenClosed: YES]; } - (id) document