diff --git a/ChangeLog b/ChangeLog index 3ae719a47..cf8fe5a38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-03-05 Fred Kiefer + + * Source/GSNibLoading.m (NSCustomView): Correct implementation of + -initWithCoder: and remove -awakeAfterUsingCoder:. + * Source/NSSound.m: Remove method -awakeAfterUsingCoder:. + * Source/NSWindow.m (-_captureMouse:, -_releaseMouse:) Add some + debug log code here to simplify debugging these methods. + 2011-03-04 Fred Kiefer * Headers/AppKit/PSOperators.h diff --git a/Source/GSNibLoading.m b/Source/GSNibLoading.m index c6724f47d..a6170a6bf 100644 --- a/Source/GSNibLoading.m +++ b/Source/GSNibLoading.m @@ -1038,42 +1038,40 @@ static BOOL _isInInterfaceBuilder = NO; - (id) nibInstantiate { - Class aClass; - if ([NSClassSwapper isInInterfaceBuilder]) { _view = self; return self; } - else + + if (_view == nil) { - aClass = NSClassFromString(_className); - } + Class aClass; - // If the class name is nil, assume NSView. - if (_className == nil) - { - aClass = [NSView class]; - } + // If the class name is nil, assume NSView. + if (_className == nil) + { + aClass = [NSView class]; + } + else + { + aClass = NSClassFromString(_className); + } - if (aClass == nil) - { - [NSException raise: NSInternalInconsistencyException - format: @"Unable to find class '%@'", _className]; - } - else - { - _view = [[aClass allocWithZone: NSDefaultMallocZone()] initWithFrame: [self frame]]; + if (aClass == nil) + { + [NSException raise: NSInternalInconsistencyException + format: @"Unable to find class '%@'", _className]; + } + else + { + _view = [[aClass allocWithZone: NSDefaultMallocZone()] initWithFrame: [self frame]]; + } } return _view; } -- (id) awakeAfterUsingCoder: (NSCoder *)coder -{ - return _view; -} - - (id) nibInstantiateWithCoder: (NSCoder *)coder { if ([NSClassSwapper isInInterfaceBuilder]) @@ -1137,46 +1135,46 @@ static BOOL _isInInterfaceBuilder = NO; if ([NSClassSwapper isInInterfaceBuilder]) { self = [super initWithCoder: coder]; + if (self == nil) + { + return nil; + } } - if (self != nil) + if ([coder allowsKeyedCoding]) { - if ([coder allowsKeyedCoding]) + // get the super stuff without calling super... + if ([coder containsValueForKey: @"NSFrame"]) { - // get the super stuff without calling super... - if ([coder containsValueForKey: @"NSFrame"]) - { - _frame = [coder decodeRectForKey: @"NSFrame"]; - } - else - { - _frame = NSZeroRect; - if ([coder containsValueForKey: @"NSFrameSize"]) - { - _frame.size = [coder decodeSizeForKey: @"NSFrameSize"]; - } - } - - ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]); - ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]); - - if ([self nibInstantiate] != nil) - { - [self nibInstantiateWithCoder: coder]; - } - - if (self != _view) - { - AUTORELEASE(self); - [(NSKeyedUnarchiver *)coder replaceObject: self withObject: _view]; - } + _frame = [coder decodeRectForKey: @"NSFrame"]; } else { - [NSException raise: NSInvalidArgumentException - format: @"Can't decode %@ with %@.",NSStringFromClass([self class]), - NSStringFromClass([coder class])]; + _frame = NSZeroRect; + if ([coder containsValueForKey: @"NSFrameSize"]) + { + _frame.size = [coder decodeSizeForKey: @"NSFrameSize"]; + } } + + ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]); + ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]); + + if ([self nibInstantiate] != nil) + { + [self nibInstantiateWithCoder: coder]; + } + + if (self != _view) + { + AUTORELEASE(self); + } + } + else + { + [NSException raise: NSInvalidArgumentException + format: @"Can't decode %@ with %@.",NSStringFromClass([self class]), + NSStringFromClass([coder class])]; } return _view; diff --git a/Source/NSSound.m b/Source/NSSound.m index 577291841..525a582a9 100644 --- a/Source/NSSound.m +++ b/Source/NSSound.m @@ -767,11 +767,6 @@ static inline void _loadNSSoundPlugIns (void) return self; } -- (id) awakeAfterUsingCoder: (NSCoder *)coder -{ - return self; -} - // // NSCopying // diff --git a/Source/NSWindow.m b/Source/NSWindow.m index f8a0c593e..d969bc152 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -5451,11 +5451,13 @@ current key view.
*/ - (void) _captureMouse: sender { + NSDebugLLog(@"CaptureMouse", @"Capturing the mouse"); [GSCurrentServer() capturemouse: _windowNum]; } - (void) _releaseMouse: sender { + NSDebugLLog(@"CaptureMouse", @"Releasing the mouse"); [GSCurrentServer() releasemouse]; }