From eeae653c9416d2a616c958f1c1b47715765d6573 Mon Sep 17 00:00:00 2001 From: saikat Date: Mon, 2 Nov 2009 00:25:30 -0800 Subject: [PATCH 1/5] Made secure text fields have the right number of characters when focus is taken away from them. Closes issue #318. --- AppKit/CPTextField.j | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 7c748dcd9..926810c36 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -978,7 +978,8 @@ var secureStringForString = function(aString) // This is true for when aString === "" and null/undefined. if (!aString) return ""; - return Array(aString.length).join(CPSecureTextFieldCharacter); + + return Array(aString.length+1).join(CPSecureTextFieldCharacter); } From e8b1ff88461f8b4eb303e5435079f00b40159af2 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Mon, 2 Nov 2009 00:37:40 -0800 Subject: [PATCH 2/5] Another Array().join() trick off-by-one bug. --- Objective-J/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objective-J/utilities.js b/Objective-J/utilities.js index 31c18333b..f4315bf0d 100644 --- a/Objective-J/utilities.js +++ b/Objective-J/utilities.js @@ -168,7 +168,7 @@ var _sprintf_justify = function(sign, prefix, string, suffix, width, leftJustify var _sprintf_pad = function(n, ch) { - return Array(MAX(0,n)).join(ch); + return Array(MAX(0,n)+1).join(ch); } // Base64 encoding and decoding From 93c90274b5376b5c7ef0c9dea0c1ffcec4499ab7 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Mon, 2 Nov 2009 16:47:07 -0800 Subject: [PATCH 3/5] Updates for massaging a few key inputs. --- AppKit/CPApplication.j | 3 +++ AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 23 +++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index a567a454c..b71659232 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -459,7 +459,10 @@ CPRunContinuesResponse = -1002; // Check if this is a candidate for key equivalent... if ([anEvent _couldBeKeyEquivalent] && [self _handleKeyEquivalent:anEvent]) + { + [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO]; return; + } if (_eventListeners.length) { diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 5733dac6c..5bd3393fd 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -448,14 +448,16 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; KeyCodesToPrevent[aDOMEvent.keyCode]; var isNativePasteEvent = NO, - isNativeCopyOrCutEvent = NO; + isNativeCopyOrCutEvent = NO, + overrideCharacters = nil; switch (aDOMEvent.type) { case "keydown": // Grab and store the keycode now since it is correct and consistent at this point. _keyCode = aDOMEvent.keyCode; - + var characters = String.fromCharCode(_keyCode).toLowerCase(); + overrideCharacters = modifierFlags & CPShiftKeyMask ? characters.toUpperCase() : characters; // If this could be a native PASTE event, then we need to further examine it before // sending a CPEvent. Select our element to see if anything gets pasted in it. @@ -474,7 +476,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; // can capture our internal Cappuccino pasteboard. else if ((characters == "c" || characters == "x") && (modifierFlags & CPPlatformActionKeyMask)) isNativeCopyOrCutEvent = YES; - + // Also, certain browsers (IE and Safari), have broken keyboard supportwhere they don't send keypresses for certain events. // So, allow the keypress event to handle the event if we are not a browser with broken (remedial) key support... else if (!CPFeatureIsCompatible(CPJavascriptRemedialKeySupport)) @@ -487,6 +489,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; // If this is in fact our broke state, continue to keypress and send the keydown. case "keypress": // If the source of this event is our pasteboard element, then simply let it continue // as normal, so that the paste event can successfully complete. + if ((aDOMEvent.target || aDOMEvent.srcElement) == _DOMPasteboardElement) return; @@ -495,20 +498,22 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; isARepeat = (_charCodes[keyCode] != nil); _charCodes[keyCode] = charCode; - - var characters = String.fromCharCode(charCode), + + var characters = overrideCharacters || String.fromCharCode(charCode), charactersIgnoringModifiers = characters.toLowerCase(); - + + // Safari won't send proper capitalization during cmd-key events + if (!overrideCharacters && (modifierFlags & CPCommandKeyMask) && (modifierFlags & CPShiftKeyMask)) + characters = characters.toUpperCase(); + event = [CPEvent keyEventWithType:CPKeyDown location:location modifierFlags:modifierFlags timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:charactersIgnoringModifiers isARepeat:isARepeat keyCode:keyCode]; - + if (isNativePasteEvent) { _pasteboardKeyDownEvent = event; - window.setNativeTimeout(function () { [self _checkPasteboardElement] }, 0); - return; } From 420ce1799a352c27539b2d7f876254413a8b389b Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 2 Nov 2009 18:31:14 -0800 Subject: [PATCH 4/5] Added check to make sure user is using the right versions of jake and browserjs. Reviewed by me. --- common.jake | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/common.jake b/common.jake index 48de164fd..c2f308973 100644 --- a/common.jake +++ b/common.jake @@ -1,4 +1,28 @@ +function ensurePackageUpToDate(packageName, requiredVersion) +{ + var version = require("packages").catalog[packageName].version; + + if (version && require("util").compare(version.split("."), requiredVersion.split(".")) !== -1) + return; + + print("Your copy of " + packageName + " is out of date (version " + version + "). Update? yes or no:"); + + var response = system.stdin.readLine(); + + if (response !== "yes\n") + { + print("Jake aborted."); + require("os").exit(1); + } + + require("os").system("NARWHAL_ENGINE_HOME='' NARWHAL_ENGINE=rhino tusk install --force " + packageName); +} + +// UPDATE THESE TO PICK UP CORRESPONDING CHANGES IN DEPENDENCIES +ensurePackageUpToDate("jake", "0.1.1"); +ensurePackageUpToDate("browserjs", "0.1"); + var Jake = require("jake"); global.ENV = require("system").env; From fe91331dc4b7505867602220c10d749f7dc7fc1d Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Mon, 2 Nov 2009 19:38:25 -0800 Subject: [PATCH 5/5] Updated readme file to remove references to rake. Reviewed by me. --- README | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README b/README index efba48fe3..e5340c2f2 100644 --- a/README +++ b/README @@ -38,11 +38,16 @@ instead download a pre-compiled copy of Cappuccino from: http://cappuccino.org/download/ -To build Cappuccino from source, simply type "rake" from within the root of the Cappuccino directory. -This will build a "release" copy of the frameworks. Typing "rake debug" will build a debug version. -"rake install" will build Cappuccino and associated tools and install them for general use (similar to +To build Cappuccino from source, simply type "jake" from within the root of the Cappuccino directory. +This will build a "release" copy of the frameworks. Typing "jake debug" will build a debug version. +"jake install" will build Cappuccino and associated tools and install them for general use (similar to downloading the tools from the website). +If this is your first build and your system does not have jake installed, run the bootstrap script to +install it and all of its dependencies: + +$ sudo ./bootstrap.sh + Getting Help ------------ If you need help with Cappuccino, you can get help from the following sources: