summaryrefslogtreecommitdiff
path: root/delegateuitask_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'delegateuitask_darwin.m')
-rw-r--r--delegateuitask_darwin.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/delegateuitask_darwin.m b/delegateuitask_darwin.m
index a1f9501..94051c0 100644
--- a/delegateuitask_darwin.m
+++ b/delegateuitask_darwin.m
@@ -56,6 +56,13 @@ extern NSRect dummyRect;
@implementation appDelegate
+- (void)uipost:(id)pv
+{
+ NSValue *v = (NSValue *) pv;
+
+ appDelegate_uipost([v pointerValue]);
+}
+
- (BOOL)windowShouldClose:(id)win
{
return appDelegate_windowShouldClose(win);
@@ -123,6 +130,18 @@ BOOL initCocoa(id appDelegate)
return YES;
}
+void uipost(id appDelegate, void *data)
+{
+ // need an autorelease pool here
+ NSAutoreleasePool *pool;
+
+ pool = [NSAutoreleasePool new];
+ [appDelegate performSelectorOnMainThread:@selector(uipost:)
+ withObject:[NSValue valueWithPointer:data]
+ waitUntilDone:YES]; // note this bit; see uitask_darwin.go for details
+ [pool release];
+}
+
void breakMainLoop(void)
{
NSEvent *e;