summaryrefslogtreecommitdiff
path: root/new/init_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'new/init_darwin.m')
-rw-r--r--new/init_darwin.m38
1 files changed, 38 insertions, 0 deletions
diff --git a/new/init_darwin.m b/new/init_darwin.m
new file mode 100644
index 0000000..86f271c
--- /dev/null
+++ b/new/init_darwin.m
@@ -0,0 +1,38 @@
+// 6 april 2015
+#include "ui_darwin.m"
+
+@interface uiApplication : NSApplication
+@end
+
+@implementation uiApplication
+
+// hey look! we're overriding terminate:!
+// we're going to make sure we can go back to main() whether Cocoa likes it or not!
+// and just how are we going to do that, hm?
+// (note: this is called after applicationShouldTerminate:)
+- (void)terminate:(id)sender
+{
+ // yes that's right folks: DO ABSOLUTELY NOTHING.
+ // the magic is [NSApp run] will just... stop.
+}
+
+@end
+
+// TODO applicationShouldTerminateAfterLastWindowClosed
+
+uiInitError *uiInit(uiInitOptions *o)
+{
+ [uiApplication sharedApplication];
+ // don't check for a NO return; something (launch services?) causes running from application bundles to always return NO when asking to change activation policy, even if the change is to the same activation policy!
+ // see https://github.com/andlabs/ui/issues/6
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+ return NULL;
+}
+
+const char *uiInitErrorMessage(uiInitError *err)
+{
+}
+
+void uiInitErrorFree(uiInitError *err)
+{
+}