diff options
author | koekeishiya <aasvi93@hotmail.com> | 2017-08-08 13:56:57 +0200 |
---|---|---|
committer | koekeishiya <aasvi93@hotmail.com> | 2017-08-08 13:56:57 +0200 |
commit | a58d0c8980560bde4c2ab6635584ed830fd06eed (patch) | |
tree | e5ba46f1c93d4e56ae8c6787e053ce0e0dea99fb /src/hotkey.h | |
parent | 03b74b16c003137e123032ea70f392533ce87355 (diff) | |
download | skhd-a58d0c8980560bde4c2ab6635584ed830fd06eed.tar.gz skhd-a58d0c8980560bde4c2ab6635584ed830fd06eed.zip |
linked list -> hashmap; optimizations
Diffstat (limited to 'src/hotkey.h')
-rw-r--r-- | src/hotkey.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/hotkey.h b/src/hotkey.h index 293f04f..614665d 100644 --- a/src/hotkey.h +++ b/src/hotkey.h @@ -5,8 +5,6 @@ #include <stdint.h> #include <stdbool.h> -#define internal static - enum osx_event_mask { Event_Mask_Alt = 0x00080000, @@ -52,30 +50,31 @@ struct hotkey uint32_t flags; uint32_t key; char *command; - struct hotkey *next; }; -internal inline void +static inline void add_flags(struct hotkey *hotkey, uint32_t flag) { hotkey->flags |= flag; } -internal inline bool +static inline bool has_flags(struct hotkey *hotkey, uint32_t flag) { bool result = hotkey->flags & flag; return result; } -internal inline void +static inline void clear_flags(struct hotkey *hotkey, uint32_t flag) { hotkey->flags &= ~flag; } -bool find_and_exec_hotkey(struct hotkey *eventkey, struct hotkey *hotkeys); -struct hotkey cgevent_to_hotkey(CGEventFlags flags, uint32_t key); -void free_hotkeys(struct hotkey *hotkeys); +bool find_and_exec_hotkey(struct hotkey *eventkey, struct table *hotkey_map); +void cgeventflags_to_hotkeyflags(CGEventFlags flags, struct hotkey *eventkey); + +struct table; +void free_hotkeys(struct table *hotkey_map); #endif |