aboutsummaryrefslogtreecommitdiff
path: root/src/event_tap.h
diff options
context:
space:
mode:
authorkoekeishiya <aasvi93@hotmail.com>2017-08-07 20:23:44 +0200
committerkoekeishiya <aasvi93@hotmail.com>2017-08-07 20:23:44 +0200
commitd69056799a399058005b4950751397a31110de4a (patch)
tree1dee43a2f247094c58d1263cee8c8477b893e376 /src/event_tap.h
downloadskhd-d69056799a399058005b4950751397a31110de4a.tar.gz
skhd-d69056799a399058005b4950751397a31110de4a.zip
v0.0.1
Diffstat (limited to 'src/event_tap.h')
-rw-r--r--src/event_tap.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/event_tap.h b/src/event_tap.h
new file mode 100644
index 0000000..b126ce4
--- /dev/null
+++ b/src/event_tap.h
@@ -0,0 +1,25 @@
+#ifndef SKHD_EVENT_TAP_H
+#define SKHD_EVENT_TAP_H
+
+#include <stdbool.h>
+#include <Carbon/Carbon.h>
+
+struct event_tap
+{
+ CFMachPortRef handle;
+ CFRunLoopSourceRef runloop_source;
+ CGEventMask mask;
+};
+
+#define EVENT_TAP_CALLBACK(name) \
+ CGEventRef name(CGEventTapProxy proxy, \
+ CGEventType type, \
+ CGEventRef event, \
+ void *reference)
+typedef EVENT_TAP_CALLBACK(event_tap_callback);
+
+bool event_tap_enabled(struct event_tap *event_tap);
+bool event_tap_begin(struct event_tap *event_tap, event_tap_callback *callback);
+void event_tap_end(struct event_tap *event_tap);
+
+#endif