summaryrefslogtreecommitdiff
path: root/new/init_darwin.m
blob: d26c3fa528e631efb3afb57343961dc630f8ff55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 6 april 2015
#import "uipriv_darwin.h"

@interface uiApplication : NSApplication
@end

@implementation uiApplication

uiLogObjCClassAllocations

// 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)
{
	return "";
}

void uiInitErrorFree(uiInitError *err)
{
}