From 23a5b83ea6c3ae9a59661a5f0bb903f66f36cc51 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 10 May 2011 19:20:37 -0400 Subject: [PATCH 1/5] Corrected and added -performKeyEquivalent docs. --- AppKit/CPResponder.j | 17 ++++++++++++----- AppKit/CPView.j | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/AppKit/CPResponder.j b/AppKit/CPResponder.j index 8890dc63e..73199a1b5 100644 --- a/AppKit/CPResponder.j +++ b/AppKit/CPResponder.j @@ -231,11 +231,18 @@ CPDeleteForwardKeyCode = 46; [_nextResponder performSelector:_cmd withObject:anEvent]; } -/* - FIXME This description is bad. - Based on \c anEvent, the receiver should simulate the event. - @param anEvent the event to simulate - @return \c YES if the event receiver simulated the event +/*! + Overridden by subclasses to handle a key equivalent. + + If the character code or codes in \c anEvent match the receiver’s key equivalent, + the receiver should respond to the event and return \c YES. The default implementation + does nothing and returns \c NO. + + You should extract the characters for a key equivalent using + \ref CPEvent::charactersIgnoringModifiers "[anEvent charactersIgnoringModifiers]". + + @param anEvent An event object that represents the key equivalent pressed + @return \c YES if theEvent is a key equivalent that the receiver handled, \c NO if it is not a key equivalent that it should handle. */ - (BOOL)performKeyEquivalent:(CPEvent)anEvent { diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 58b37ea70..83ea1842d 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -2129,6 +2129,20 @@ setBoundsOrigin: @implementation CPView (KeyView) +/*! + Overridden by subclasses to handle a key equivalent. + + If the receiver’s key equivalent is the same as the characters of the key-down event theEvent, + as returned by \ref CPEvent::charactersIgnoringModifiers "[anEvent charactersIgnoringModifiers]", + the receiver should take the appropriate action and return \c YES. Otherwise, it should return + the result of invoking super’s implementation. The default implementation of this method simply + passes the message down the view hierarchy (from superviews to subviews) + and returns \c NO if none of the receiver’s subviews responds \c YES. + + @param anEvent An event object that represents the key equivalent pressed + @return \c YES if theEvent is a key equivalent that the receiver handled, + \c NO if it is not a key equivalent that it should handle. +*/ - (BOOL)performKeyEquivalent:(CPEvent)anEvent { var count = [_subviews count]; From b84d7218871082b5b614abeace54030dc5fb7f9c Mon Sep 17 00:00:00 2001 From: Mason Mark Date: Wed, 11 May 2011 13:15:12 +0900 Subject: [PATCH 2/5] Fix build-time test for presence of Mac OS X 10.5 SDK Some jake build tasks test whether the 10.5 SDK is present, and if so, they build using it. However, the path to the SDK is not necessarily consistent across installations, so testing for path existence is not the best way to check whether the SDK is present. Doing it that way caused build failures on machines with both Xcode 3 and Xcode 4 installed. In this fix, we now ask xcodebuild what SDKs are present, and only fall back on the path existence test if the local copy of xcodebuild does not support listing SDKs (as is the case for old versions of xcodebuild). --- Tools/NativeHost/Jakefile | 2 +- Tools/fontinfo/Jakefile | 2 +- common.jake | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Tools/NativeHost/Jakefile b/Tools/NativeHost/Jakefile index a092ea137..8df9bce4b 100644 --- a/Tools/NativeHost/Jakefile +++ b/Tools/NativeHost/Jakefile @@ -11,7 +11,7 @@ task ("build", function() { var args = "-alltargets -configuration Release"; - if (FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk"))) + if (xcodebuildHasTenPointFiveSDK()) args = "-sdk macosx10.5 " + args; else diff --git a/Tools/fontinfo/Jakefile b/Tools/fontinfo/Jakefile index 4ab6d6c6e..38d02b91c 100644 --- a/Tools/fontinfo/Jakefile +++ b/Tools/fontinfo/Jakefile @@ -10,7 +10,7 @@ task ("build", function() { var args = "-alltargets -configuration " + $CONFIGURATION; - if (FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk"))) + if (xcodebuildHasTenPointFiveSDK()) args = "-sdk macosx10.5 " + args; else diff --git a/common.jake b/common.jake index f1fa62f74..9331f5dba 100644 --- a/common.jake +++ b/common.jake @@ -456,6 +456,21 @@ global.copyManPage = function(/*String*/ name, /*int*/ section) } } +global.xcodebuildCanListSDKs = function () +{ + return OS.system("xcodebuild -showsdks > /dev/null 2>&1") == 0; +} + +global.xcodebuildHasTenPointFiveSDK = function () +{ + if (xcodebuildCanListSDKs()) { + return OS.system("xcodebuild -showsdks | grep 'macosx10.5' > /dev/null 2>&1") == 0; + } else { + return (FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk"))); + } +} + + // built in tasks From 402c82801b881041fb35a2487072c836106749c2 Mon Sep 17 00:00:00 2001 From: Mason Mark Date: Wed, 11 May 2011 13:23:09 +0900 Subject: [PATCH 3/5] Extra newline typo --- common.jake | 1 - 1 file changed, 1 deletion(-) diff --git a/common.jake b/common.jake index 9331f5dba..170a0f9f1 100644 --- a/common.jake +++ b/common.jake @@ -471,7 +471,6 @@ global.xcodebuildHasTenPointFiveSDK = function () } - // built in tasks task ("build"); From 7059dd63b7577020788631b4d68f3c958955a39c Mon Sep 17 00:00:00 2001 From: Mason Mark Date: Wed, 11 May 2011 13:26:18 +0900 Subject: [PATCH 4/5] Use code style similar to other code in file --- common.jake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common.jake b/common.jake index 170a0f9f1..ac0acb8f0 100644 --- a/common.jake +++ b/common.jake @@ -463,11 +463,10 @@ global.xcodebuildCanListSDKs = function () global.xcodebuildHasTenPointFiveSDK = function () { - if (xcodebuildCanListSDKs()) { + if (xcodebuildCanListSDKs()) return OS.system("xcodebuild -showsdks | grep 'macosx10.5' > /dev/null 2>&1") == 0; - } else { + else return (FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk"))); - } } From 019acb76a36fcf3de7384c16fddac5a9f0695192 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Tue, 10 May 2011 21:34:34 -0700 Subject: [PATCH 5/5] Very minor style change. Reviewed by me. --- common.jake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.jake b/common.jake index ac0acb8f0..2fec57d27 100644 --- a/common.jake +++ b/common.jake @@ -465,8 +465,8 @@ global.xcodebuildHasTenPointFiveSDK = function () { if (xcodebuildCanListSDKs()) return OS.system("xcodebuild -showsdks | grep 'macosx10.5' > /dev/null 2>&1") == 0; - else - return (FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk"))); + + return FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk")); }