Compare commits
10 Commits
1.3
...
maintenance-1.x
| Author | SHA1 | Date | |
|---|---|---|---|
| a3a459b4e4 | |||
| 443e2db73d | |||
| 5c7dd53380 | |||
| 72904d4dde | |||
| aa6c9fbab9 | |||
| 7308a0927d | |||
| d95c03289c | |||
| 14a9a4c4a6 | |||
| 9266e38517 | |||
| ddab66d2c0 |
@@ -25,7 +25,7 @@
|
||||
return shared;
|
||||
}
|
||||
|
||||
+ (void)registerGlobalShortcutWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler;
|
||||
+ (void)registerGlobalShortcutWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler
|
||||
{
|
||||
MASShortcutUserDefaultsHotKey *hotKey = [[MASShortcutUserDefaultsHotKey alloc] initWithUserDefaultsKey:userDefaultsKey handler:handler];
|
||||
[[self registeredUserDefaultsHotKeys] setObject:hotKey forKey:userDefaultsKey];
|
||||
@@ -54,12 +54,6 @@
|
||||
NSString *_observableKeyPath;
|
||||
}
|
||||
|
||||
@synthesize monitor = _monitor;
|
||||
@synthesize handler = _handler;
|
||||
@synthesize userDefaultsKey = _userDefaultsKey;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
void *MASShortcutUserDefaultsContext = &MASShortcutUserDefaultsContext;
|
||||
|
||||
- (id)initWithUserDefaultsKey:(NSString *)userDefaultsKey handler:(void (^)())handler
|
||||
|
||||
+4
-2
@@ -320,6 +320,7 @@ BOOL MASShortcutAllowsAnyHotkeyWithOptionModifier = NO;
|
||||
- (BOOL)isTakenError:(NSError **)outError
|
||||
{
|
||||
CFArrayRef globalHotKeys;
|
||||
BOOL isTaken = NO;
|
||||
if (CopySymbolicHotKeys(&globalHotKeys) == noErr) {
|
||||
|
||||
// Enumerate all global hotkeys and check if any of them matches current shortcut
|
||||
@@ -341,12 +342,13 @@ BOOL MASShortcutAllowsAnyHotkeyWithOptionModifier = NO;
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObject:description forKey:NSLocalizedDescriptionKey];
|
||||
*outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:info];
|
||||
}
|
||||
return YES;
|
||||
isTaken = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CFRelease(globalHotKeys);
|
||||
}
|
||||
return [self isKeyEquivalent:self.keyCodeStringForKeyEquivalent flags:self.modifierFlags takenInMenu:[NSApp mainMenu] error:outError];
|
||||
return (isTaken || [self isKeyEquivalent:self.keyCodeStringForKeyEquivalent flags:self.modifierFlags takenInMenu:[NSApp mainMenu] error:outError]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
+12
-11
@@ -1,13 +1,14 @@
|
||||
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
|
||||
s.platform = :osx
|
||||
s.osx.deployment_target = "10.7"
|
||||
s.name = 'MASShortcut'
|
||||
s.version = '1.3.1'
|
||||
s.summary = 'Modern framework for managing global keyboard shortcuts compatible with Mac App Store'
|
||||
s.homepage = 'https://github.com/shpakovski/MASShortcut'
|
||||
s.authors = { 'Vadim Shpakovski' => 'vadim@shpakovski.com' }
|
||||
s.license = 'BSD 2-clause'
|
||||
s.source = { :git => 'https://github.com/shpakovski/MASShortcut.git', :tag => '1.3.1' }
|
||||
s.source_files = '*.{h,m}'
|
||||
s.osx.frameworks = 'Carbon', 'AppKit'
|
||||
s.requires_arc = true
|
||||
end
|
||||
|
||||
@@ -45,11 +45,6 @@ void *MASAssociatedDefaultsObserver = &MASAssociatedDefaultsObserver;
|
||||
BOOL _internalShortcutChange;
|
||||
}
|
||||
|
||||
@synthesize userDefaultsKey = _userDefaultsKey;
|
||||
@synthesize shortcutView = _shortcutView;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (id)initWithShortcutView:(MASShortcutView *)shortcutView userDefaultsKey:(NSString *)userDefaultsKey
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
typedef enum {
|
||||
MASShortcutViewAppearanceDefault = 0, // Height = 19 px
|
||||
MASShortcutViewAppearanceTexturedRect, // Height = 25 px
|
||||
MASShortcutViewAppearanceRounded // Height = 43 px
|
||||
MASShortcutViewAppearanceRounded, // Height = 43 px
|
||||
MASShortcutViewAppearanceFlat
|
||||
} MASShortcutViewAppearance;
|
||||
|
||||
@interface MASShortcutView : NSView
|
||||
|
||||
@@ -107,6 +107,12 @@
|
||||
_shortcutCell.bezelStyle = NSRoundedBezelStyle;
|
||||
break;
|
||||
}
|
||||
case MASShortcutViewAppearanceFlat: {
|
||||
self.wantsLayer = YES;
|
||||
_shortcutCell.backgroundColor = [NSColor clearColor];
|
||||
_shortcutCell.bordered = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +182,10 @@
|
||||
[_shortcutCell drawWithFrame:CGRectOffset(frame, 0.0, 1.0) inView:self];
|
||||
break;
|
||||
}
|
||||
case MASShortcutViewAppearanceFlat: {
|
||||
[_shortcutCell drawWithFrame:frame inView:self];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +237,7 @@
|
||||
switch (self.appearance) {
|
||||
case MASShortcutViewAppearanceTexturedRect: hintButtonWidth += 2.0; break;
|
||||
case MASShortcutViewAppearanceRounded: hintButtonWidth += 3.0; break;
|
||||
case MASShortcutViewAppearanceFlat: hintButtonWidth -= 8.0 - (_shortcutCell.font.pointSize - BUTTON_FONT_SIZE); break;
|
||||
default: break;
|
||||
}
|
||||
CGRectDivide(self.bounds, &hintRect, &shortcutRect, hintButtonWidth, CGRectMaxXEdge);
|
||||
|
||||
Reference in New Issue
Block a user