Document close fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17688 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-09-20 03:07:55 +00:00
parent 50ed66958a
commit 1d187a4550
3 changed files with 29 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2003-09-19 Matt Rice <ratmice@yahoo.com>
* 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 <fedor@gnu.org> 2003-09-19 Adam Fedor <fedor@gnu.org>
* Headers/Additions/GNUstepGUI/GSMethodTable.h: Change NSReadPixel * Headers/Additions/GNUstepGUI/GSMethodTable.h: Change NSReadPixel

View file

@ -1649,16 +1649,6 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException));
} }
resp = [resp nextResponder]; resp = [resp nextResponder];
} }
if ([keyWindow respondsToSelector: aSelector])
{
return keyWindow;
}
resp = [keyWindow delegate];
if (resp != nil && [resp respondsToSelector: aSelector])
{
return resp;
}
if ([NSDocumentController isDocumentBasedApplication]) if ([NSDocumentController isDocumentBasedApplication])
{ {
@ -1670,6 +1660,17 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException));
return resp; return resp;
} }
} }
if ([keyWindow respondsToSelector: aSelector])
{
return keyWindow;
}
resp = [keyWindow delegate];
if (resp != nil && [resp respondsToSelector: aSelector])
{
return resp;
}
} }
if (_session != 0) if (_session != 0)

View file

@ -2304,6 +2304,8 @@ resetCursorRectsForView(NSView *theView)
- (void) performClose: (id)sender - (void) performClose: (id)sender
{ {
NSDocument *document = [_windowController document];
/* Don't close if a modal session is running and we are not the /* Don't close if a modal session is running and we are not the
modal window */ modal window */
if ([NSApp modalWindow] && self != [NSApp modalWindow]) if ([NSApp modalWindow] && self != [NSApp modalWindow])
@ -2318,8 +2320,6 @@ resetCursorRectsForView(NSView *theView)
if (_windowController) if (_windowController)
{ {
NSDocument *document = [_windowController document];
if (document && ![document shouldCloseWindowController: _windowController]) if (document && ![document shouldCloseWindowController: _windowController])
{ {
NSBeep(); NSBeep();
@ -2355,7 +2355,14 @@ resetCursorRectsForView(NSView *theView)
} }
// FIXME: The button should be highlighted // FIXME: The button should be highlighted
if (document)
{
[document close];
}
else
{
[self close]; [self close];
}
} }
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent - (BOOL) performKeyEquivalent: (NSEvent*)theEvent