diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-01 17:11:08 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-01 17:11:08 -0400 |
| commit | 37051f5c15ba64f22de431c41cb88947af361b32 (patch) | |
| tree | 45f05f54e53a776cc68c5546bfa5b14d24dc97e3 /delegateuitask_darwin.m | |
| parent | 2a7152339fd5cd7306bdc420ffea7b3af4f6845e (diff) | |
Migrated the Mac OS X backend to the new uitask system.
Diffstat (limited to 'delegateuitask_darwin.m')
| -rw-r--r-- | delegateuitask_darwin.m | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/delegateuitask_darwin.m b/delegateuitask_darwin.m index e30ebc2..4d38e3a 100644 --- a/delegateuitask_darwin.m +++ b/delegateuitask_darwin.m @@ -56,11 +56,15 @@ extern NSRect dummyRect; @implementation appDelegate -- (void)uitask:(NSValue *)fp +// these are the uitask actions + +- (void)createWindow:(NSValue *)fp { - appDelegate_uitask([fp pointerValue]); + uitask_createWindow([fp pointerValue]); } +// these are the other delegate functions + - (BOOL)windowShouldClose:(id)win { return appDelegate_windowShouldClose(win); @@ -111,6 +115,9 @@ id windowGetContentView(id window) return [((NSWindow *) window) contentView]; } +// these are for douitask() but are here because @selector() is not a constant expression +SEL createWindow; + BOOL initCocoa(id appDelegate) { // on 10.6 the -[NSApplication setDelegate:] method complains if we don't have one @@ -124,11 +131,13 @@ BOOL initCocoa(id appDelegate) return NO; [NSApp activateIgnoringOtherApps:YES]; // TODO actually do C.NO here? Russ Cox does YES in his devdraw; the docs say the Finder does NO [NSApp setDelegate:appDelegate]; + // uitask selectors + createWindow = @selector(createWindow:); [pool release]; return YES; } -void douitask(id appDelegate, void *p) +void douitask(id appDelegate, SEL sel, void *p) { NSAutoreleasePool *pool; NSValue *fp; @@ -136,7 +145,7 @@ void douitask(id appDelegate, void *p) // we need to make an NSAutoreleasePool, otherwise we get leak warnings on stderr pool = [NSAutoreleasePool new]; fp = [NSValue valueWithPointer:p]; - [appDelegate performSelectorOnMainThread:@selector(uitask:) + [appDelegate performSelectorOnMainThread:sel withObject:fp waitUntilDone:YES]; // wait so we can properly drain the autorelease pool; on other platforms we wind up waiting anyway (since the main thread can only handle one thing at a time) so [pool release]; |
