diff options
| author | Dave DeLong | 2010-08-15 11:23:20 -0600 |
|---|---|---|
| committer | Dave DeLong | 2010-08-15 11:23:20 -0600 |
| commit | 3907cfe61dc13daa38b779f7596a424222c1d74c (patch) | |
| tree | 0d21ebce66c988d50ca771c6f5e451cd4c6c3eba | |
| parent | 8f564da37891b67325f86b6b0ec80150056d3d52 (diff) | |
| download | DDHotKey-3907cfe61dc13daa38b779f7596a424222c1d74c.tar.bz2 | |
Updated macro to the more appropriate NS_BLOCKS_AVAILABLE
| -rw-r--r-- | DDHotKeyCenter.h | 6 | ||||
| -rw-r--r-- | DDHotKeyCenter.m | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/DDHotKeyCenter.h b/DDHotKeyCenter.h index 05cfbfc..1991a31 100644 --- a/DDHotKeyCenter.h +++ b/DDHotKeyCenter.h @@ -10,9 +10,7 @@ #import <Cocoa/Cocoa.h> -#define BUILD_FOR_SNOWLEOPARD (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - -#if BUILD_FOR_SNOWLEOPARD +#if NS_BLOCKS_AVAILABLE //a convenient typedef for the required signature of a hotkey block callback typedef void (^DDHotKeyTask)(NSEvent*); #endif @@ -28,7 +26,7 @@ typedef void (^DDHotKeyTask)(NSEvent*); */ - (BOOL) registerHotKeyWithKeyCode:(unsigned short)keyCode modifierFlags:(NSUInteger)flags target:(id)target action:(SEL)action object:(id)object; -#if BUILD_FOR_SNOWLEOPARD +#if NS_BLOCKS_AVAILABLE /** Register a block callback hotkey. The modifierFlags must be a bitwise OR of NSCommandKeyMask, NSAlternateKeyMask, NSControlKeyMask, or NSShiftKeyMask; diff --git a/DDHotKeyCenter.m b/DDHotKeyCenter.m index 7fc4af4..22d3c1c 100644 --- a/DDHotKeyCenter.m +++ b/DDHotKeyCenter.m @@ -25,7 +25,7 @@ NSUInteger dd_translateModifierFlags(NSUInteger flags); SEL action; id object; -#if BUILD_FOR_SNOWLEOPARD +#if NS_BLOCKS_AVAILABLE DDHotKeyTask task; #endif @@ -38,7 +38,7 @@ NSUInteger dd_translateModifierFlags(NSUInteger flags); @property (retain) id target; @property SEL action; @property (retain) id object; -#if BUILD_FOR_SNOWLEOPARD +#if NS_BLOCKS_AVAILABLE @property (copy) DDHotKeyTask task; #endif @property unsigned short keyCode; @@ -60,7 +60,7 @@ NSUInteger dd_translateModifierFlags(NSUInteger flags); if (target != nil && action != nil && [target respondsToSelector:action]) { [target performSelector:action withObject:event withObject:object]; } -#if BUILD_FOR_SNOWLEOPARD +#if NS_BLOCKS_AVAILABLE else if (task != nil) { task(event); } @@ -133,7 +133,7 @@ NSUInteger dd_translateModifierFlags(NSUInteger flags); return ([[self hotKeysMatchingPredicate:predicate] count] > 0); } -#if BUILD_FOR_SNOWLEOPARD +#if NS_BLOCKS_AVAILABLE - (BOOL) registerHotKeyWithKeyCode:(unsigned short)keyCode modifierFlags:(NSUInteger)flags task:(DDHotKeyTask)task { //we can't add a new hotkey if something already has this combo if ([self hasRegisteredHotKeyWithKeyCode:keyCode modifierFlags:flags]) { return NO; } |
