diff options
author | sqweek <sqweek@gmail.com> | 2015-11-11 21:02:21 +0800 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2015-11-11 15:09:34 +0000 |
commit | 6a93bd5c92bd2954314f492f10bbcac2c3416da0 (patch) | |
tree | 40340568d69057b06a6c1db3525b54fa325d29f7 /src/cmd/devdraw | |
parent | 8db40354c5ded13fac5974de4f7cc1b7f0087d67 (diff) | |
download | plan9port-6a93bd5c92bd2954314f492f10bbcac2c3416da0.tar.gz plan9port-6a93bd5c92bd2954314f492f10bbcac2c3416da0.tar.bz2 plan9port-6a93bd5c92bd2954314f492f10bbcac2c3416da0.zip |
devdraw: cocoa: set window title on main thread
Change-Id: Ie818f9246f749a9d3293019a1e01be4ce7e368b9
Reviewed-on: https://plan9port-review.googlesource.com/1400
Reviewed-by: Russ Cox <rsc@swtch.com>
Diffstat (limited to 'src/cmd/devdraw')
-rw-r--r-- | src/cmd/devdraw/cocoa-screen.m | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m index fc73814b..3607ab41 100644 --- a/src/cmd/devdraw/cocoa-screen.m +++ b/src/cmd/devdraw/cocoa-screen.m @@ -137,6 +137,7 @@ static void makeicon(void); static void makemenu(void); static void makewin(char*); static void sendmouse(void); +static void kicklabel0(char*); static void setcursor0(Cursor*); static void togglefs(void); static void acceptresizing(int); @@ -232,6 +233,7 @@ static NSRect dilate(NSRect); + (void)callflushimg:(NSValue*)v{ flushimg([v rectValue]);} + (void)callmakewin:(NSValue*)v{ makewin([v pointerValue]);} + (void)callsetcursor0:(NSValue*)v{ setcursor0([v pointerValue]);} ++ (void)callkicklabel0:(NSValue*)v{ kicklabel0([v pointerValue]);} @end static Memimage* initimg(void); @@ -1358,11 +1360,19 @@ putsnarf(char *s) void kicklabel(char *label) { - NSString *s; - if(label == nil) return; + [appdelegate + performSelectorOnMainThread:@selector(callkicklabel0:) + withObject:[NSValue valueWithPointer:label] + waitUntilDone:YES]; +} + +static void +kicklabel0(char *label) { + NSString *s; + s = [[NSString alloc] initWithUTF8String:label]; [win.ofs[0] setTitle:s]; [win.ofs[1] setTitle:s]; |