From 48a311eb9096cf7680a91fc7906c0487fce33473 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Mon, 31 Mar 2014 15:27:35 +0200 Subject: Fixed string literal warning --- MASShortcutView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MASShortcutView.m b/MASShortcutView.m index ba28e47..9f1b7f4 100644 --- a/MASShortcutView.m +++ b/MASShortcutView.m @@ -380,9 +380,9 @@ void *kUserDataHint = &kUserDataHint; [weakSelf activateEventMonitoring:NO]; NSString *format = NSLocalizedString(@"The key combination %@ cannot be used", @"Title for alert when shortcut is already used"); - NSRunCriticalAlertPanel([NSString stringWithFormat:format, shortcut], error.localizedDescription, + NSRunCriticalAlertPanel([NSString stringWithFormat:format, shortcut], @"%@", NSLocalizedString(@"OK", @"Alert button when shortcut is already used"), - nil, nil); + nil, nil, error.localizedDescription); weakSelf.shortcutPlaceholder = nil; [weakSelf activateResignObserver:YES]; [weakSelf activateEventMonitoring:YES]; -- cgit v1.2.3 From 7d3604820ec26cdc2a4d72f96ecda7eb65f78f12 Mon Sep 17 00:00:00 2001 From: ShadowLightz Date: Sat, 14 Jun 2014 14:08:03 +0200 Subject: Replace depr. NSRunCriticalAlertPanel with NSAlert - Now using modern API - The dialog is now shown as a modal sheet, which suits better - The alert style is changed to NSWarningAlertStyle, - NSCriticalAlertStyle was not required --- MASShortcutView.m | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/MASShortcutView.m b/MASShortcutView.m index 9f1b7f4..82f4b4b 100644 --- a/MASShortcutView.m +++ b/MASShortcutView.m @@ -380,12 +380,17 @@ void *kUserDataHint = &kUserDataHint; [weakSelf activateEventMonitoring:NO]; NSString *format = NSLocalizedString(@"The key combination %@ cannot be used", @"Title for alert when shortcut is already used"); - NSRunCriticalAlertPanel([NSString stringWithFormat:format, shortcut], @"%@", - NSLocalizedString(@"OK", @"Alert button when shortcut is already used"), - nil, nil, error.localizedDescription); - weakSelf.shortcutPlaceholder = nil; - [weakSelf activateResignObserver:YES]; - [weakSelf activateEventMonitoring:YES]; + NSAlert* alert = [[NSAlert alloc]init]; + alert.messageText = [NSString stringWithFormat:format, shortcut]; + alert.informativeText = error.localizedDescription; + alert.alertStyle = NSWarningAlertStyle; + weakSelf.recording = NO; + [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) { + weakSelf.shortcutPlaceholder = nil; + [weakSelf activateResignObserver:YES]; + [weakSelf activateEventMonitoring:YES]; + weakSelf.recording = YES; + }]; } else { weakSelf.shortcutValue = shortcut; -- cgit v1.2.3 From dc088a3a7795b731eb5390a9420a0348779e0cc5 Mon Sep 17 00:00:00 2001 From: LIU Dongyuan / 柳东原 Date: Fri, 18 Jul 2014 22:45:18 -0700 Subject: Create MASShortcut.podspec --- MASShortcut.podspec | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 MASShortcut.podspec diff --git a/MASShortcut.podspec b/MASShortcut.podspec new file mode 100644 index 0000000..22afc6b --- /dev/null +++ b/MASShortcut.podspec @@ -0,0 +1,13 @@ +Pod::Spec.new do |s| + s.name = 'MASShortcut' + s.version = '1.2.3' + s.summary = 'Modern framework for managing global keyboard shortcuts compatible with Mac App Store' + s.homepage = 'https://github.com/sonoramac/MASShortcut' + s.authors = { 'Vadim Shpakovski' => 'vadim@shpakovski.com' } + s.license = 'BSD 2-clause' + + s.source = { :git => 'git@github.com:shpakovski/MASShortcut.git', :tag => '1.2.3' } + s.source_files = '*.{h,m}' + s.framework = 'Carbon' + s.requires_arc = true +end -- cgit v1.2.3 From 42dfc38ef6d8bbe0edf51bb1adaf494b7912b786 Mon Sep 17 00:00:00 2001 From: Kevin Wojniak Date: Sun, 20 Jul 2014 15:50:15 -0700 Subject: Fixed compiling with projects that don't use a precompiled header. --- MASShortcut.h | 1 + MASShortcutView.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/MASShortcut.h b/MASShortcut.h index 06507f6..905ddaf 100644 --- a/MASShortcut.h +++ b/MASShortcut.h @@ -1,4 +1,5 @@ #import +#import #define MASShortcutChar(char) [NSString stringWithFormat:@"%C", (unsigned short)(char)] #define MASShortcutClear(flags) (flags & (NSControlKeyMask | NSShiftKeyMask | NSAlternateKeyMask | NSCommandKeyMask)) diff --git a/MASShortcutView.h b/MASShortcutView.h index 13163d4..d6a4313 100644 --- a/MASShortcutView.h +++ b/MASShortcutView.h @@ -1,3 +1,5 @@ +#import + @class MASShortcut; typedef enum { -- cgit v1.2.3 From 549b3ef29edd64d3911968d381712500295da655 Mon Sep 17 00:00:00 2001 From: Antonin Hildebrand Date: Tue, 26 Aug 2014 13:16:04 +0200 Subject: allow [MODIFIER]+ESC shortcuts only naked ESC without modifiers should cancel editing http://discuss.binaryage.com/t/cant-change-activation-key-to-control-esc tested in TotalTerminal codebase --- MASShortcutView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MASShortcutView.m b/MASShortcutView.m index 82f4b4b..96dcc86 100644 --- a/MASShortcutView.m +++ b/MASShortcutView.m @@ -359,7 +359,7 @@ void *kUserDataHint = &kUserDataHint; weakSelf.recording = NO; event = nil; } - else if (shortcut.keyCode == kVK_Escape) { + else if (shortcut.keyCode == kVK_Escape && !shortcut.modifierFlags) { // Cancel recording weakSelf.recording = NO; event = nil; -- cgit v1.2.3 From 0633545a4666d969dfbb860e540eb3b008893651 Mon Sep 17 00:00:00 2001 From: Vadim Shpakovski Date: Tue, 2 Sep 2014 09:43:53 +0300 Subject: Ignoring disabled system shortcuts. --- MASShortcut.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MASShortcut.m b/MASShortcut.m index 4e9888d..5b94310 100644 --- a/MASShortcut.m +++ b/MASShortcut.m @@ -322,9 +322,11 @@ BOOL MASShortcutAllowsAnyHotkeyWithOptionModifier = NO; CFDictionaryRef hotKeyInfo = CFArrayGetValueAtIndex(globalHotKeys, i); CFNumberRef code = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyCode); CFNumberRef flags = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyModifiers); + CFNumberRef enabled = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyEnabled); if (([(__bridge NSNumber *)code unsignedIntegerValue] == self.keyCode) && - ([(__bridge NSNumber *)flags unsignedIntegerValue] == self.carbonFlags)) { + ([(__bridge NSNumber *)flags unsignedIntegerValue] == self.carbonFlags) && + ([(__bridge NSNumber *)enabled boolValue])) { if (outError) { NSString *description = NSLocalizedString(@"This combination cannot be used because it is already used by a system-wide " -- cgit v1.2.3 From a5c2e159354c8474579d96971a9103f3f11c1e39 Mon Sep 17 00:00:00 2001 From: Paulo F. Andrade Date: Mon, 17 Feb 2014 15:09:41 +0000 Subject: Added support for secure coding --- MASShortcut.h | 2 +- MASShortcut.m | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MASShortcut.h b/MASShortcut.h index 905ddaf..c9081a2 100644 --- a/MASShortcut.h +++ b/MASShortcut.h @@ -31,7 +31,7 @@ enum { kMASShortcutGlyphSoutheastArrow = 0x2198, } MASShortcutGlyph; -@interface MASShortcut : NSObject +@interface MASShortcut : NSObject @property (nonatomic) NSUInteger keyCode; @property (nonatomic) NSUInteger modifierFlags; diff --git a/MASShortcut.m b/MASShortcut.m index 5b94310..b217a98 100644 --- a/MASShortcut.m +++ b/MASShortcut.m @@ -13,6 +13,11 @@ NSString *const MASShortcutModifierFlags = @"ModifierFlags"; #pragma mark - ++ (BOOL)supportsSecureCoding +{ + return YES; +} + - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeInteger:(self.keyCode != NSNotFound ? (NSInteger)self.keyCode : - 1) forKey:MASShortcutKeyCode]; -- cgit v1.2.3