summaryrefslogtreecommitdiff
path: root/new/main_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-06 19:04:13 -0400
committerPietro Gagliardi <[email protected]>2015-04-06 19:04:13 -0400
commite4d6d11925e7da8eb8b6c2960ddff88245b876ff (patch)
tree108614ac94157838c121d5ec9358ca76f6b15374 /new/main_darwin.m
parent9001ca34f73ad861c049f367e2ef8477d19e7432 (diff)
Started writing the same but for Mac OS X. This time it's not tested yet; will test now.
Diffstat (limited to 'new/main_darwin.m')
-rw-r--r--new/main_darwin.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/new/main_darwin.m b/new/main_darwin.m
new file mode 100644
index 0000000..be9b599
--- /dev/null
+++ b/new/main_darwin.m
@@ -0,0 +1,28 @@
+// 6 april 2015
+#include "ui_darwin.h"
+
+// TODO merge with init_darwin.m?
+
+void uiMain(void)
+{
+ [NSApp run];
+}
+
+void uiQuit(void)
+{
+ NSEvent *e;
+
+ [NSApp stop:NSApp];
+ // stop: won't register until another event has passed; let's synthesize one
+ e = [NSEvent otherEventWithType:NSApplicationDefined
+ location:NSZeroPoint
+ modifierFlags:0
+ timestamp:[[NSProcessInfo processInfo] systemUptime]
+ windowNumber:0
+ context:[NSGraphicsContext currentContext]
+ subtype:0
+ data1:0
+ data2:0];
+ [NSApp postEvent:e atStart:NO]; // let pending events take priority
+ // TODO really wait?
+}