blob: faf78a2891343fbac39d2320d3d8c7ea96bd0a18 (
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
|
// 8 july 2014
#import "objc_darwin.h"
#import "_cgo_export.h"
#import <Cocoa/Cocoa.h>
@interface appDelegateClass : NSObject
@end
@implementation appDelegateClass
@end
appDelegateClass *appDelegate;
id getAppDelegate(void)
{
return appDelegate;
}
BOOL uiinit(void)
{
appDelegate = [appDelegateClass new];
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp activateIgnoringOtherApps:YES]; // TODO rsc does this; finder says NO?
[NSApp setDelegate:appDelegate];
return YES;
}
void uimsgloop(void)
{
[NSApp run];
}
// thanks to mikeash in irc.freenode.net/#macdev for suggesting the use of Grand Dispatch and blocks for this
void issue(void *what)
{
dispatch_async(dispatch_get_main_queue(), ^{
doissue(what);
});
}
|