summaryrefslogtreecommitdiff
path: root/new/darwin/main.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-15 18:49:45 -0400
committerPietro Gagliardi <[email protected]>2015-04-15 18:49:45 -0400
commit518a5ddbf15d50a254c732a80d5907ef8878abe0 (patch)
tree48cf259f98994e4570e65c389fcd9824272884ad /new/darwin/main.m
parent50ae3ca045e7f5f5744043df0a4506e2f6930bb1 (diff)
Split all OS backends into their own folders.
Diffstat (limited to 'new/darwin/main.m')
-rw-r--r--new/darwin/main.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/new/darwin/main.m b/new/darwin/main.m
new file mode 100644
index 0000000..8663b58
--- /dev/null
+++ b/new/darwin/main.m
@@ -0,0 +1,27 @@
+// 6 april 2015
+#import "uipriv_darwin.h"
+
+// #qo LDFLAGS: -lobjc -framework Foundation -framework AppKit
+
+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 (this is what PostQuitMessage() on Windows does so we have to do it here too for parity; thanks to mikeash in irc.freenode.net/#macdev for confirming that this parameter should indeed be NO)
+}