From 6e425a9de8c003b5a733621a6b6730ec3cc902b8 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Sat, 23 Dec 2006 00:30:12 +0000 Subject: 20061220 --- emu/Plan9/win.c | 69 +++++++++++++++++++-------------------------------------- 1 file changed, 23 insertions(+), 46 deletions(-) (limited to 'emu/Plan9/win.c') diff --git a/emu/Plan9/win.c b/emu/Plan9/win.c index d86eea15..2f280853 100644 --- a/emu/Plan9/win.c +++ b/emu/Plan9/win.c @@ -16,14 +16,14 @@ enum extern Memimage *screenimage; -ulong* attachwindow(Rectangle*, ulong*, int*, int*); +static ulong* attachwindow(Rectangle*, ulong*, int*, int*); static void plan9readmouse(void*); static void plan9readkeybd(void*); static int mapspecials(char *s1, char *s2, int *n); -int pixels = 1; int usenewwin = 1; +int kbdiscons; static int truedepth; static int datafd; @@ -84,31 +84,35 @@ attachscreen(Rectangle *r, ulong *chan, int *d, int *width, int *softscreen) fprint(2, "attachscreen: can't mount window manager: %r\n"); return nil; } + if(bind("/mnt/wsys", "/dev", MBEFORE) < 0){ + fprint(2, "attachscreen: can't bind /mnt/wsys before /dev: %r\n"); + return nil; + } } - cursfd = open("/mnt/wsys/cursor", OWRITE); + cursfd = open("/dev/cursor", OWRITE); if(cursfd < 0) { fprint(2, "attachscreen: open cursor: %r\n"); return nil; } /* Set up graphics window console (chars->gkbdq) */ - keybdfd = open("/mnt/wsys/cons", OREAD); + keybdfd = open("/dev/cons", OREAD); if(keybdfd < 0) { fprint(2, "attachscreen: open keyboard: %r\n"); return nil; } - mousefd = open("/mnt/wsys/mouse", ORDWR); + mousefd = open("/dev/mouse", ORDWR); if(mousefd < 0){ fprint(2, "attachscreen: can't open mouse: %r\n"); return nil; } - if(usenewwin){ - fd = open("/mnt/wsys/consctl", OWRITE); + if(usenewwin || 1){ + fd = open("/dev/consctl", OWRITE); if(fd < 0) - fprint(2, "attachscreen: open /mnt/wsys/consctl: %r\n"); + fprint(2, "attachscreen: open /dev/consctl: %r\n"); if(write(fd, "rawon", 5) != 5) - fprint(2, "attachscreen: write /mnt/wsys/consctl: %r\n"); + fprint(2, "attachscreen: write /dev/consctl: %r\n"); } /* Set up graphics files */ @@ -148,11 +152,11 @@ attachscreen(Rectangle *r, ulong *chan, int *d, int *width, int *softscreen) mousepid = kproc("readmouse", plan9readmouse, nil, 0); keybdpid = kproc("readkbd", plan9readkeybd, nil, 0); - bind("/mnt/wsys", "/dev", MBEFORE); fd = open("/dev/label", OWRITE); - if (fd >= 0) { - write(fd, "inferno", 7); + if(fd >= 0){ + snprint(buf, sizeof(buf), "inferno %d", getpid()); + write(fd, buf, strlen(buf)); close(fd); } @@ -160,35 +164,7 @@ attachscreen(Rectangle *r, ulong *chan, int *d, int *width, int *softscreen) return (uchar*)data; } -static int -depthof(char *s) -{ - char *es; - int n, c, d; - - es = s+12; - while(s