[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSDocument close & NSApplication targetForAction
From: |
Adam Fedor |
Subject: |
Re: NSDocument close & NSApplication targetForAction |
Date: |
20 Sep 2003 20:34:00 -0600 |
On Sat, 2003-09-20 at 10:55, Fred Kiefer wrote:
> Matt Rice wrote:
> > bug when using NSDocument, the key window always
> > responds to close and so NSDocument close never gets
> > called.. and reopening a document would show the one
> > which you just "closed" rather than reading from
> > disk.. (tested with Ink..)
> >
> > this patch moves the check for document based apps up
> > above the key window, and checks for them on
> > performClose for the windowmaker close button.
>
> Sorry for replying so late, I was away for a week. Still I want to
> oppose this change as it does not stick with the documentation.
>
> As for the first part of the patch it changes the search order for
> targets in a way that does not correspond to what the Cocoa
> documentation says. According to this the document is asked right after
> the windows delegate. If we cannot prove that this is handled
> differently in the actual Cocoa implementation we should keep the old
> way. Perhaps we have to change the way NSWindow implements close, as I
> can see the real problem that this patch tries to fix.
>
I don't really see where it says this, unless it's somewhere in the
NSDocument documentation. NSApplication documentation doesn't mention
anything about documents.
> The second part is even worse, here closing the window and closing the
> document are mixed. This are two almost independend operations. A
> document may have multiple windows and may only close when the last one
> gets closed or sometimes not even then. Again I understand why this
> patch was intendend, but it tries to solve the problem the wrong way.
I looked at this again and found the real reason this doesn't work. I
put this patch in instead:
Index: Source/NSWindowController.m
===================================================================
RCS file:
/cvsroot/gnustep/gnustep/core/gui/Source/NSWindowController.m,v
retrieving revision 1.15
diff -u -r1.15 NSWindowController.m
--- Source/NSWindowController.m 30 Aug 2003 19:13:10 -0000 1.15
+++ Source/NSWindowController.m 21 Sep 2003 02:24:17 -0000
@@ -160,6 +160,8 @@
released. */
[_window setReleasedWhenClosed: NO];
}
+ else
+ [_window setReleasedWhenClosed: YES];
}