summaryrefslogtreecommitdiffstats
path: root/macosx/main.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2019-08-12 10:19:00 +0200
committerDamiano Galassi <[email protected]>2019-08-12 10:19:00 +0200
commitc5a4d181ebedbdee2bdfefeffa28128d0b9c95c1 (patch)
tree635e3d036b7065987f29d38489838ceb6cdd11eb /macosx/main.m
parent76d08e5d4bb6287de03519cf43cc298d2d896a7a (diff)
MacGui: enable and fix more warnings. Review nullability annotations.
Diffstat (limited to 'macosx/main.m')
-rw-r--r--macosx/main.m25
1 files changed, 25 insertions, 0 deletions
diff --git a/macosx/main.m b/macosx/main.m
new file mode 100644
index 000000000..961d1fa78
--- /dev/null
+++ b/macosx/main.m
@@ -0,0 +1,25 @@
+/* $Id: main.mm,v 1.3 2005/11/25 15:04:35 titer Exp $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char **argv)
+{
+ // Register a signal handler using grand central dispatch.
+ dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGINT, 0, dispatch_get_main_queue());
+ dispatch_source_set_event_handler(source, ^{
+ [NSApp terminate:nil];
+ });
+ dispatch_resume(source);
+
+ // Tell sigaction to ignore the SIGINT signal
+ // because we handle it already with gcd.
+ struct sigaction action = { {0}, 0, 0 };
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGINT, &action, NULL);
+
+ return NSApplicationMain(argc, argv);
+}