diff options
Diffstat (limited to 'Framework')
| -rw-r--r-- | Framework/Info.plist | 4 | ||||
| -rw-r--r-- | Framework/MASShortcut.h | 11 | ||||
| -rw-r--r-- | Framework/MASShortcut.m | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/Framework/Info.plist b/Framework/Info.plist index 8aafeae..679ef34 100644 --- a/Framework/Info.plist +++ b/Framework/Info.plist @@ -15,9 +15,9 @@ <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> - <string>2.1.1</string> + <string>2.1.2</string> <key>CFBundleVersion</key> - <string>2.1.1</string> + <string>2.1.2</string> <key>NSHumanReadableCopyright</key> <string>Copyright © 2014–2015 Vadim Shpakovski. All rights reserved.</string> </dict> diff --git a/Framework/MASShortcut.h b/Framework/MASShortcut.h index e175317..8f420e4 100644 --- a/Framework/MASShortcut.h +++ b/Framework/MASShortcut.h @@ -39,6 +39,11 @@ /** A string representing the “key” part of a shortcut, like the `5` in `⌘5`. + + @warning The value may change depending on the active keyboard layout. + For example for the `^2` keyboard shortcut (`kVK_ANSI_2+NSControlKeyMask` + to be precise) the `keyCodeString` is `2` on the US keyboard, but `ě` when + the Czech keyboard layout is active. See the spec for details. */ @property (nonatomic, readonly) NSString *keyCodeString; @@ -49,6 +54,12 @@ property of `NSMenuItem`. Here the string is used to support shortcut validation (“is the shortcut already taken in this menu?”) and for display in `NSMenu`. + + The value of this property may differ from `keyCodeString`. For example + the Russian keyboard has a `Г` (Ge) Cyrillic character in place of the + latin `U` key. This means you can create a `^Г` shortcut, but in menus + that’s always displayed as `^U`. So the `keyCodeString` returns `Г` + and `keyCodeStringForKeyEquivalent` returns `U`. */ @property (nonatomic, readonly) NSString *keyCodeStringForKeyEquivalent; diff --git a/Framework/MASShortcut.m b/Framework/MASShortcut.m index e6fa63d..ef3385d 100644 --- a/Framework/MASShortcut.m +++ b/Framework/MASShortcut.m @@ -139,10 +139,10 @@ static NSString *const MASShortcutModifierFlags = @"ModifierFlags"; case 115: return NSStringFromMASKeyCode(kMASShortcutGlyphNorthwestArrow); } - // Everything else should be printable so look it up in the current keyboard + // Everything else should be printable so look it up in the current ASCII capable keyboard layout OSStatus error = noErr; NSString *keystroke = nil; - TISInputSourceRef inputSource = TISCopyCurrentKeyboardLayoutInputSource(); + TISInputSourceRef inputSource = TISCopyCurrentASCIICapableKeyboardLayoutInputSource(); if (inputSource) { CFDataRef layoutDataRef = TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData); if (layoutDataRef) { |
