-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change USE_OBJC flag to USE_APPKIT. Fixes #133
- Loading branch information
Showing
3 changed files
with
12 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
#include <dlfcn.h> | ||
#include <mach/mach_time.h> | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
#include <objc/objc.h> | ||
#include <objc/objc-runtime.h> | ||
#endif | ||
|
@@ -44,7 +44,7 @@ typedef struct _event_runloop_info { | |
CFRunLoopObserverRef observer; | ||
} event_runloop_info; | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
static id auto_release_pool; | ||
|
||
typedef struct { | ||
|
@@ -504,7 +504,7 @@ static inline void process_modifier_changed(uint64_t timestamp, CGEventRef event | |
} | ||
} | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
static void obcj_message(void *info) { | ||
TISEventMessage *data = (TISEventMessage *) info; | ||
|
||
|
@@ -527,7 +527,7 @@ static inline void process_system_key(uint64_t timestamp, CGEventRef event_ref) | |
UInt32 subtype = 0; | ||
UInt32 data1 = 0; | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
bool is_runloop_main = CFEqual(event_loop, CFRunLoopGetMain()); | ||
tis_event_message->event = event_ref; | ||
tis_event_message->subtype = 0; | ||
|
@@ -580,7 +580,7 @@ static inline void process_system_key(uint64_t timestamp, CGEventRef event_ref) | |
|
||
free(buffer); | ||
CFRelease(data_ref); | ||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
} | ||
#endif | ||
|
||
|
@@ -1323,7 +1323,7 @@ UIOHOOK_API int hook_run() { | |
return UIOHOOK_ERROR_OUT_OF_MEMORY; | ||
} | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
tis_event_message = (TISEventMessage *) calloc(1, sizeof(TISEventMessage)); | ||
if (tis_event_message == NULL) { | ||
logger(LOG_LEVEL_ERROR, "%s [%u]: Failed to allocate memory for TIS event structure!\n", | ||
|
@@ -1384,7 +1384,7 @@ UIOHOOK_API int hook_run() { | |
} | ||
} | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
// Contributed by Alex <[email protected]> | ||
// Create a garbage collector to handle Cocoa events correctly. | ||
Class NSAutoreleasePool_class = (Class) objc_getClass("NSAutoreleasePool"); | ||
|
@@ -1399,7 +1399,7 @@ UIOHOOK_API int hook_run() { | |
CFRunLoopRun(); | ||
|
||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
// Contributed by Alex <[email protected]> | ||
eventWithoutCGEvent(auto_release_pool, sel_registerName("release")); | ||
#endif | ||
|
@@ -1414,7 +1414,7 @@ UIOHOOK_API int hook_run() { | |
pthread_mutex_unlock(&main_runloop_mutex); | ||
#endif | ||
|
||
#ifdef USE_OBJC | ||
#ifdef USE_APPKIT | ||
free(tis_event_message); | ||
#endif | ||
free(tis_keycode_message); | ||
|