diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 93f806436..86257d3fc 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -414,16 +414,23 @@ var DOMElementPrototype = nil, /* @ignore */ - (void)_setWindow:(CPWindow)aWindow { - // FIXME: check _window == aWindow? If not, comment why! - if ([_window firstResponder] == self) + if (_window === aWindow) + return; + + // Clear out first responder if we're the first responder and leaving. + if ([_window firstResponder] === self) [_window makeFirstResponder:nil]; // Notify the view and its subviews [self viewWillMoveToWindow:aWindow]; - [_subviews makeObjectsPerformSelector:@selector(_setWindow:) withObject:aWindow]; - + _window = aWindow; + var count = [_subviews count]; + + while (count--) + [_subviews[count] _setWindow:aWindow]; + [self viewDidMoveToWindow]; } diff --git a/Tools/nib2cib/NSCell.j b/Tools/nib2cib/NSCell.j index 583fa028a..4dcaa4e83 100644 --- a/Tools/nib2cib/NSCell.j +++ b/Tools/nib2cib/NSCell.j @@ -68,7 +68,7 @@ _controlSize = (flags2 & 0xE0000) >> 17; _objectValue = [aCoder decodeObjectForKey:@"NSContents"]; - _font = [aCoder decodeObjectForKey:@"NSFont"]; + _font = [aCoder decodeObjectForKey:@"NSSupport"]; } return self; diff --git a/Tools/nib2cib/NSFont.j b/Tools/nib2cib/NSFont.j index 7416e412d..5a5c09cac 100644 --- a/Tools/nib2cib/NSFont.j +++ b/Tools/nib2cib/NSFont.j @@ -27,8 +27,17 @@ - (id)NS_initWithCoder:(CPCoder)aCoder { - // FIXME: bold? - return [self _initWithName:[aCoder decodeObjectForKey:@"NSName"] size:[aCoder decodeDoubleForKey:@"NSSize"] bold:NO]; + var isBold = NO, + fontName = [aCoder decodeObjectForKey:@"NSName"]; + + // FIXME: Is this alwasy true? + if (fontName.indexOf("-Bold") === fontName.length - "-Bold".length) + isBold = YES; + + if (fontName === "LucidaGrande" || fontName === "LucidaGrande-Bold") + fontName = "Arial"; + + return [self _initWithName:fontName size:[aCoder decodeDoubleForKey:@"NSSize"] bold:isBold]; } @end