diff options
author | Russ Cox <rsc@swtch.com> | 2009-06-16 07:16:25 -0700 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2009-06-16 07:16:25 -0700 |
commit | 4a34106c7d95df617021900f5d52a79f5a502288 (patch) | |
tree | bbc0665d9d560f0323ab2b15a66321950fc6dbb2 /src/cmd | |
parent | b8f457199c4228aed8a8049639e85df2c9cbe858 (diff) | |
parent | b8f457199c4228aed8a8049639e85df2c9cbe858 (diff) | |
download | plan9port-4a34106c7d95df617021900f5d52a79f5a502288.tar.gz plan9port-4a34106c7d95df617021900f5d52a79f5a502288.tar.bz2 plan9port-4a34106c7d95df617021900f5d52a79f5a502288.zip |
merge
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/9pfuse/fuse_kernel.h | 6 | ||||
-rw-r--r-- | src/cmd/devdraw/osx-screen.c | 42 | ||||
-rw-r--r-- | src/cmd/devdraw/osx-screen.h | 1 | ||||
-rw-r--r-- | src/cmd/devdraw/osx-srv.c | 2 |
4 files changed, 46 insertions, 5 deletions
diff --git a/src/cmd/9pfuse/fuse_kernel.h b/src/cmd/9pfuse/fuse_kernel.h index e529b8de..cdedd2fb 100644 --- a/src/cmd/9pfuse/fuse_kernel.h +++ b/src/cmd/9pfuse/fuse_kernel.h @@ -64,13 +64,13 @@ struct fuse_attr { __u64 atime; __u64 mtime; __u64 ctime; -#if (__FreeBSD__ >= 10 && __OSX_VERSION__ >= 100500) +#if (__FreeBSD__ >= 10 && OSX_VERSION >= 100500) __u64 crtime; #endif /* __FreeBSD__ >= 10 */ __u32 atimensec; __u32 mtimensec; __u32 ctimensec; -#if (__FreeBSD__ >= 10 && __OSX_VERSION__ >= 100500) +#if (__FreeBSD__ >= 10 && OSX_VERSION >= 100500) __u32 crtimensec; #endif /* __FreeBSD__ >= 10 */ __u32 mode; @@ -80,7 +80,7 @@ struct fuse_attr { __u32 rdev; #if (__FreeBSD__ >= 10) __u32 flags; /* file flags; see chflags(2) */ -#if __OSX_VERSION__ < 100500 +#if OSX_VERSION < 100500 __u32 padding; #endif /* __OSX_VERSION__ < 100500 */ #endif /* __FreeBSD__ >= 10 */ diff --git a/src/cmd/devdraw/osx-screen.c b/src/cmd/devdraw/osx-screen.c index 8939ee31..dc2fb092 100644 --- a/src/cmd/devdraw/osx-screen.c +++ b/src/cmd/devdraw/osx-screen.c @@ -29,7 +29,9 @@ extern Rectangle mouserect; struct { char *label; + int newlabel; char *winsize; + QLock labellock; Rectangle fullscreenr; Rectangle screenr; @@ -88,7 +90,7 @@ attachscreen(char *label, char *winsize) { if(label == nil) label = "gnot a label"; - osx.label = label; + osx.label = strdup(label); osx.winsize = winsize; if(osx.screenimage == nil){ screeninit(); @@ -244,6 +246,14 @@ eventhandler(EventHandlerCallRef next, EventRef event, void *arg) { OSStatus result; + if(osx.newlabel) { + // dummy message so we update the label + qlock(&osx.labellock); + setlabel(osx.label); + osx.newlabel = 0; + qunlock(&osx.labellock); + } + result = CallNextEventHandler(next, event); switch(GetEventClass(event)){ @@ -828,6 +838,36 @@ setlabel(char *label) CFRelease(cs); } +void +kicklabel(char *label) +{ + char *p; + + p = strdup(label); + if(p == nil) + return; + qlock(&osx.labellock); + free(osx.label); + osx.newlabel = 1; + osx.label = p; + qunlock(&osx.labellock); + + // TODO(rsc): It would be great to send an OS X event to the + // event handling loop to force the update of the label, + // but I cannot manage to do this. + // int i; + // EventRef ev; + /* + ev = 0; + i = CreateEvent(nil, kEventClassApplication, 0, 0, 0, &ev); + if(i != 0) + fprint(2, "CreateEvent: %d\n", i); + i = SendEventToEventTarget(ev, GetUserFocusEventTarget()); + if(i != 0) + fprint(2, "SendEventToEventTarget %p: %d\n", ev, i); + */ +} + static void seticon(void) { diff --git a/src/cmd/devdraw/osx-screen.h b/src/cmd/devdraw/osx-screen.h index 52204686..f50d8dfe 100644 --- a/src/cmd/devdraw/osx-screen.h +++ b/src/cmd/devdraw/osx-screen.h @@ -12,6 +12,7 @@ void putsnarf(char*); void mousetrack(int, int, int, int); void keystroke(int); +void kicklabel(char*); extern Rectangle mouserect; extern int mouseresized; diff --git a/src/cmd/devdraw/osx-srv.c b/src/cmd/devdraw/osx-srv.c index 10baf0f3..ae14ba18 100644 --- a/src/cmd/devdraw/osx-srv.c +++ b/src/cmd/devdraw/osx-srv.c @@ -238,7 +238,7 @@ runmsg(Wsysmsg *m) break; case Tlabel: - setlabel(m->label); + kicklabel(m->label); replymsg(m); break; |