From 5fd5ad3d85ff91b2c3bcf8fd6db26bdde4cc7646 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 7 Mar 2021 02:44:04 +0100 Subject: main: Move hotkey registration to a new function Split this into a more descriptive function. Still need to set up proper error handling. --- main.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.m b/main.m index 7b54de8..87e64c0 100644 --- a/main.m +++ b/main.m @@ -3,11 +3,21 @@ #import "Invert.h" #import "DDHotKeyCenter.h" +int register_hotkeys(); + int main(int argc, const char * argv[]) { [NSAutoreleasePool new]; [NSApplication sharedApplication]; + int error_code = register_hotkeys(); + + [NSApp run]; + + return 0; +} + +int register_hotkeys() { Invert *invert = [[[Invert alloc] init] autorelease]; DDHotKeyCenter *c = [DDHotKeyCenter sharedHotKeyCenter]; @@ -32,7 +42,5 @@ int main(int argc, const char * argv[]) { NSLog(@"Error registering hotkey"); } - [NSApp run]; - return 0; } -- cgit v1.2.3