[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Renaissance and document based applications bug
From: |
Philippe Roussel |
Subject: |
Re: Renaissance and document based applications bug |
Date: |
Thu, 19 Apr 2012 22:10:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
Le 19/04/2012 13:03, Philippe Roussel a écrit :
> On Thu, Apr 19, 2012 at 09:50:03AM +0200, Fred Kiefer wrote:
>> Not sure whether your approach is the right way to solve the issue.
>> To me it rather looks like the way we implement things in gui makes
>> it hard for subclasses to do the right thing.
>>
>> If I remember correctly that extra flag in NSWidnowController was
>> only there to avoid loading the same failing NIB file twice. Not
>> sure whether that mechanism works at all after the change Jonathan
>> Gillaspie did two years ago. We could remove that flag and just
>> check whether _window is set. Or combine both and first check for
>> _window being non-null and next for the nib_is_loaded if we ever
>> want to make the functional again.
>
> I hadn't considered modifying NSWindowController (and I don't know
> why) but I like your suggestion.
> This problem with Renaissance probably is a regression in gui anyway
> so it makes sense to fix the regression and allow easy subclassing.
>
> I'll give it a try tonight if nobody beats me to it.
The following minimal patch seems to do the trick but I must confess I
didn't study NSWindowController long enough to be sure it's correct.
With this patch I don't have to patch Renaissance.
Thanks,
Philippe
Index: Source/NSWindowController.m
===================================================================
--- Source/NSWindowController.m (révision 35090)
+++ Source/NSWindowController.m (copie de travail)
@@ -292,7 +292,7 @@
- (NSWindow *) window
{
- if (_window == nil && ![self isWindowLoaded])
+ if (_window == nil)
{
// Do all the notifications. Yes, the docs say this should
// be implemented here instead of in -loadWindow itself.
@@ -435,7 +435,7 @@
- (BOOL) isWindowLoaded
{
- return _wcFlags.nib_is_loaded;
+ return _window != nil;
}
- (void) windowDidLoad
@@ -448,8 +448,6 @@
- (void) _windowDidLoad
{
- _wcFlags.nib_is_loaded = YES;
-
[self synchronizeWindowTitleWithDocumentName];
if ([self shouldCascadeWindows])
@@ -483,8 +481,6 @@
externalNameTable: table
withZone: [_owner zone]])
{
- _wcFlags.nib_is_loaded = YES;
-
if (_window == nil && _document != nil && _owner == _document)
{
[self setWindow: [_document _transferWindowOwnership]];
Index: Headers/AppKit/NSWindowController.h
===================================================================
--- Headers/AppKit/NSWindowController.h (révision 35090)
+++ Headers/AppKit/NSWindowController.h (copie de travail)
@@ -49,8 +49,7 @@
{
unsigned int should_close_document:1;
unsigned int should_cascade:1;
- unsigned int nib_is_loaded:1;
- unsigned int RESERVED:29;
+ unsigned int RESERVED:30;
} _wcFlags;
void *_reserved1;
void *_reserved2;