summaryrefslogtreecommitdiff
path: root/delegateuitask_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'delegateuitask_darwin.m')
-rw-r--r--delegateuitask_darwin.m17
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];