aboutsummaryrefslogtreecommitdiff
path: root/VKPC/SPMediaKeyTap.h
diff options
context:
space:
mode:
Diffstat (limited to 'VKPC/SPMediaKeyTap.h')
-rw-r--r--VKPC/SPMediaKeyTap.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/VKPC/SPMediaKeyTap.h b/VKPC/SPMediaKeyTap.h
new file mode 100644
index 0000000..8e7ac3d
--- /dev/null
+++ b/VKPC/SPMediaKeyTap.h
@@ -0,0 +1,43 @@
+#include <Cocoa/Cocoa.h>
+#import <IOKit/hidsystem/ev_keymap.h>
+#import <Carbon/Carbon.h>
+
+// http://overooped.com/post/2593597587/mediakeys
+
+#define SPSystemDefinedEventMediaKeys 8
+
+@interface SPMediaKeyTap : NSObject {
+ EventHandlerRef _app_switching_ref;
+ EventHandlerRef _app_terminating_ref;
+ CFMachPortRef _eventPort;
+ CFRunLoopSourceRef _eventPortSource;
+ CFRunLoopRef _tapThreadRL;
+ BOOL _shouldInterceptMediaKeyEvents;
+ id _delegate;
+ // The app that is frontmost in this list owns media keys
+ NSMutableArray *_mediaKeyAppList;
+}
++ (NSArray*)defaultMediaKeyUserBundleIdentifiers;
+
+-(id)initWithDelegate:(id)delegate;
+
++(BOOL)usesGlobalMediaKeyTap;
+-(void)startWatchingMediaKeys;
+-(void)stopWatchingMediaKeys;
+-(void)handleAndReleaseMediaKeyEvent:(NSEvent *)event;
+@end
+
+@interface NSObject (SPMediaKeyTapDelegate)
+-(void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
+@end
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// extern NSString *kMediaKeyUsingBundleIdentifiersDefaultsKey;
+// extern NSString *kIgnoreMediaKeysDefaultsKey;
+
+#ifdef __cplusplus
+}
+#endif \ No newline at end of file