From b4abc5a99dc3d41eeb8c33a0a056aacc41e834be Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 15 Jun 2009 12:33:16 -0700 Subject: [PATCH] Further key handling fixes. Reviewed by me. --- AppKit/CPMenu.j | 8 ++++---- AppKit/CPWindow/CPWindow.j | 6 +++--- AppKit/Cib/_CPCibWindowTemplate.j | 19 +++++++++++++++++++ AppKit/Platform/DOM/CPDOMWindowBridge.j | 2 +- Tools/nib2cib/NSIBObjectData.j | 2 +- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/AppKit/CPMenu.j b/AppKit/CPMenu.j index 7a8fbb622..4940bcd96 100644 --- a/AppKit/CPMenu.j +++ b/AppKit/CPMenu.j @@ -267,13 +267,13 @@ var _CPMenuBarVisible = NO, - (void)insertItem:(CPMenuItem)aMenuItem atIndex:(unsigned)anIndex { var menu = [aMenuItem menu]; - + if (menu) - if (menu != self) + if (menu !== self) [CPException raise:CPInternalInconsistencyException reason:@"Attempted to insert item into menu that was already in another menu."]; else return; - + [aMenuItem setMenu:self]; [_items insertObject:aMenuItem atIndex:anIndex]; @@ -1735,7 +1735,7 @@ var _CPMenuBarWindowBackgroundColor = nil, return frame; } -- (CPView)menuItemAtPoint:(CGPoint)aPoint +- (CPMenuItem)menuItemAtPoint:(CGPoint)aPoint { var items = [_menu itemArray], count = items.length; diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 4044620d8..e2ef55142 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -670,13 +670,13 @@ CPTexturedBackgroundWindowMask { if ([_delegate respondsToSelector:@selector(windowWillClose:)]) [_delegate windowWillClose:self]; - + [_bridge order:CPWindowOut window:self relativeTo:nil]; - + if ([CPApp keyWindow] == self) { [self resignKeyWindow]; - + CPApp._keyWindow = nil; } } diff --git a/AppKit/Cib/_CPCibWindowTemplate.j b/AppKit/Cib/_CPCibWindowTemplate.j index 2ba886395..9aea4ff28 100644 --- a/AppKit/Cib/_CPCibWindowTemplate.j +++ b/AppKit/Cib/_CPCibWindowTemplate.j @@ -33,6 +33,25 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeK BOOL _windowIsFullBridge; } +- (id)init +{ + self = [super init]; + + if (self) + { + _windowClass = @"CPWindow"; + _windowRect = CGRectMake(0.0, 0.0, 400.0, 200.0); + _windowStyleMask = CPTitledWindowMask | CPClosableWindowMask | CPMiniaturizableWindowMask | CPResizableWindowMask; + + _windowTitle = @"Window"; + _windowView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 200.0)]; + + _windowIsFullBridge = NO; + } + + return self; +} + - (id)initWithCoder:(CPCoder)aCoder { self = [super init]; diff --git a/AppKit/Platform/DOM/CPDOMWindowBridge.j b/AppKit/Platform/DOM/CPDOMWindowBridge.j index 51c1ae023..2499c84f1 100644 --- a/AppKit/Platform/DOM/CPDOMWindowBridge.j +++ b/AppKit/Platform/DOM/CPDOMWindowBridge.j @@ -394,7 +394,7 @@ var CPDOMWindowGetFrame = function(_DOMWindow) //might be mac only, we should investigate futher later. var KeyCodesToPrevent = {}, CharacterKeysToPrevent = {}, - KeyCodesWithoutKeyPressEvents = { '8':1, '9':1, '37':1, '38':1, '39':1, '40':1, '46':1, '33':1, '34':1 }; + KeyCodesWithoutKeyPressEvents = { '8':1, '9':1, '16':1, '37':1, '38':1, '39':1, '40':1, '46':1, '33':1, '34':1 }; var CTRL_KEY_CODE = 17; diff --git a/Tools/nib2cib/NSIBObjectData.j b/Tools/nib2cib/NSIBObjectData.j index a18435793..9031edd02 100644 --- a/Tools/nib2cib/NSIBObjectData.j +++ b/Tools/nib2cib/NSIBObjectData.j @@ -87,7 +87,7 @@ _objectsKeys = [aCoder decodeObjectForKey:@"NSObjectsKeys"]; _objectsValues = [aCoder decodeObjectForKey:@"NSObjectsValues"]; - + _oidKeys = [aCoder decodeObjectForKey:@"NSOidsKeys"]; _oidValues = [aCoder decodeObjectForKey:@"NSOidsValues"];