aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--MASShortcut+Monitoring.m7
-rw-r--r--MASShortcut-Prefix.pch7
-rw-r--r--MASShortcut.h5
-rw-r--r--MASShortcut.m5
-rw-r--r--MASShortcut.xcodeproj/project.pbxproj268
6 files changed, 288 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 2f72ba0..c08a725 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,4 +14,5 @@ xcuserdata
profile
*.moved-aside
# Finder
-.DS_Store \ No newline at end of file
+.DS_Store
+DerivedData
diff --git a/MASShortcut+Monitoring.m b/MASShortcut+Monitoring.m
index 4e6d82b..e6dc0a8 100644
--- a/MASShortcut+Monitoring.m
+++ b/MASShortcut+Monitoring.m
@@ -7,7 +7,12 @@ void InstallHotkeyWithShortcut(MASShortcut *shortcut, UInt32 *outCarbonHotKeyID,
#pragma mark -
-@interface MASShortcutHotKey : NSObject
+@interface MASShortcutHotKey : NSObject {
+ MASShortcut *_shortcut;
+ void (^_handler)();
+ EventHotKeyRef _carbonHotKey;
+ UInt32 _carbonHotKeyID;
+}
@property (nonatomic, readonly) MASShortcut *shortcut;
@property (nonatomic, readonly, copy) void (^handler)();
diff --git a/MASShortcut-Prefix.pch b/MASShortcut-Prefix.pch
new file mode 100644
index 0000000..2128885
--- /dev/null
+++ b/MASShortcut-Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'MASShortcut' target in the 'MASShortcut' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
diff --git a/MASShortcut.h b/MASShortcut.h
index 3c6c109..4fe3ce2 100644
--- a/MASShortcut.h
+++ b/MASShortcut.h
@@ -30,7 +30,10 @@ enum {
kMASShortcutGlyphSoutheastArrow = 0x2198,
} MASShortcutGlyph;
-@interface MASShortcut : NSObject <NSCoding>
+@interface MASShortcut : NSObject <NSCoding> {
+ NSUInteger _keyCode; // NSNotFound if empty
+ NSUInteger _modifierFlags; // 0 if empty
+}
@property (nonatomic) NSUInteger keyCode;
@property (nonatomic) NSUInteger modifierFlags;
diff --git a/MASShortcut.m b/MASShortcut.m
index 5bb039d..c277c96 100644
--- a/MASShortcut.m
+++ b/MASShortcut.m
@@ -3,10 +3,7 @@
NSString *const kMASShortcutKeyCode = @"KeyCode";
NSString *const kMASShortcutModifierFlags = @"ModifierFlags";
-@implementation MASShortcut {
- NSUInteger _keyCode; // NSNotFound if empty
- NSUInteger _modifierFlags; // 0 if empty
-}
+@implementation MASShortcut
@synthesize modifierFlags = _modifierFlags;
@synthesize keyCode = _keyCode;
diff --git a/MASShortcut.xcodeproj/project.pbxproj b/MASShortcut.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..aee8ce9
--- /dev/null
+++ b/MASShortcut.xcodeproj/project.pbxproj
@@ -0,0 +1,268 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 47C3BC1E160DF126006E3107 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47C3BC1D160DF126006E3107 /* Cocoa.framework */; };
+ 47C3BC3A160DF182006E3107 /* MASShortcut.m in Sources */ = {isa = PBXBuildFile; fileRef = 47C3BC36160DF182006E3107 /* MASShortcut.m */; };
+ 47C3BC3B160DF182006E3107 /* MASShortcut+Monitoring.m in Sources */ = {isa = PBXBuildFile; fileRef = 47C3BC37160DF182006E3107 /* MASShortcut+Monitoring.m */; };
+ 47C3BC3F160DF215006E3107 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47C3BC3E160DF215006E3107 /* Carbon.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 47C3BC1A160DF126006E3107 /* MASShortcut.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = MASShortcut.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 47C3BC1D160DF126006E3107 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+ 47C3BC20160DF126006E3107 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
+ 47C3BC21160DF126006E3107 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
+ 47C3BC22160DF126006E3107 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 47C3BC34160DF176006E3107 /* MASShortcut-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MASShortcut-Prefix.pch"; sourceTree = SOURCE_ROOT; };
+ 47C3BC36160DF182006E3107 /* MASShortcut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASShortcut.m; sourceTree = SOURCE_ROOT; };
+ 47C3BC37160DF182006E3107 /* MASShortcut+Monitoring.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MASShortcut+Monitoring.m"; sourceTree = SOURCE_ROOT; };
+ 47C3BC38160DF182006E3107 /* MASShortcut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASShortcut.h; sourceTree = SOURCE_ROOT; };
+ 47C3BC39160DF182006E3107 /* MASShortcut+Monitoring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MASShortcut+Monitoring.h"; sourceTree = SOURCE_ROOT; };
+ 47C3BC3E160DF215006E3107 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 47C3BC17160DF126006E3107 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 47C3BC3F160DF215006E3107 /* Carbon.framework in Frameworks */,
+ 47C3BC1E160DF126006E3107 /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 47C3BC0F160DF126006E3107 = {
+ isa = PBXGroup;
+ children = (
+ 47C3BC3E160DF215006E3107 /* Carbon.framework */,
+ 47C3BC23160DF126006E3107 /* MASShortcut */,
+ 47C3BC1C160DF126006E3107 /* Frameworks */,
+ 47C3BC1B160DF126006E3107 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 47C3BC1B160DF126006E3107 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 47C3BC1A160DF126006E3107 /* MASShortcut.dylib */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 47C3BC1C160DF126006E3107 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 47C3BC1D160DF126006E3107 /* Cocoa.framework */,
+ 47C3BC1F160DF126006E3107 /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 47C3BC1F160DF126006E3107 /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 47C3BC20160DF126006E3107 /* AppKit.framework */,
+ 47C3BC21160DF126006E3107 /* CoreData.framework */,
+ 47C3BC22160DF126006E3107 /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 47C3BC23160DF126006E3107 /* MASShortcut */ = {
+ isa = PBXGroup;
+ children = (
+ 47C3BC36160DF182006E3107 /* MASShortcut.m */,
+ 47C3BC37160DF182006E3107 /* MASShortcut+Monitoring.m */,
+ 47C3BC38160DF182006E3107 /* MASShortcut.h */,
+ 47C3BC39160DF182006E3107 /* MASShortcut+Monitoring.h */,
+ 47C3BC24160DF126006E3107 /* Supporting Files */,
+ );
+ path = MASShortcut;
+ sourceTree = "<group>";
+ };
+ 47C3BC24160DF126006E3107 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 47C3BC34160DF176006E3107 /* MASShortcut-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 47C3BC18160DF126006E3107 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 47C3BC19160DF126006E3107 /* MASShortcut */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 47C3BC2B160DF126006E3107 /* Build configuration list for PBXNativeTarget "MASShortcut" */;
+ buildPhases = (
+ 47C3BC16160DF126006E3107 /* Sources */,
+ 47C3BC17160DF126006E3107 /* Frameworks */,
+ 47C3BC18160DF126006E3107 /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = MASShortcut;
+ productName = MASShortcut;
+ productReference = 47C3BC1A160DF126006E3107 /* MASShortcut.dylib */;
+ productType = "com.apple.product-type.library.dynamic";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 47C3BC11160DF126006E3107 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0450;
+ ORGANIZATIONNAME = "Duane Wandless";
+ };
+ buildConfigurationList = 47C3BC14160DF126006E3107 /* Build configuration list for PBXProject "MASShortcut" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 47C3BC0F160DF126006E3107;
+ productRefGroup = 47C3BC1B160DF126006E3107 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 47C3BC19160DF126006E3107 /* MASShortcut */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 47C3BC16160DF126006E3107 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 47C3BC3A160DF182006E3107 /* MASShortcut.m in Sources */,
+ 47C3BC3B160DF182006E3107 /* MASShortcut+Monitoring.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 47C3BC29160DF126006E3107 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ VALID_ARCHS = i386;
+ };
+ name = Debug;
+ };
+ 47C3BC2A160DF126006E3107 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ SDKROOT = macosx;
+ VALID_ARCHS = i386;
+ };
+ name = Release;
+ };
+ 47C3BC2C160DF126006E3107 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "MASShortcut-Prefix.pch";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 47C3BC2D160DF126006E3107 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "MASShortcut-Prefix.pch";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 47C3BC14160DF126006E3107 /* Build configuration list for PBXProject "MASShortcut" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 47C3BC29160DF126006E3107 /* Debug */,
+ 47C3BC2A160DF126006E3107 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 47C3BC2B160DF126006E3107 /* Build configuration list for PBXNativeTarget "MASShortcut" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 47C3BC2C160DF126006E3107 /* Debug */,
+ 47C3BC2D160DF126006E3107 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 47C3BC11160DF126006E3107 /* Project object */;
+}