Little tweaks and documentation.

This commit is contained in:
rsc 2004-03-02 23:11:58 +00:00
parent efc2b0c99e
commit af78a4cd2b
11 changed files with 178 additions and 64 deletions

View file

@ -147,7 +147,7 @@ hostproc(void *arg)
i = 0;
for(;;){
i = 1-i; /* toggle */
n = read(rcfd[0], rcbuf[i].data, sizeof rcbuf[i].data);
n = threadread(rcfd[0], rcbuf[i].data, sizeof rcbuf[i].data);
if(n <= 0){
if(n < 0)
fprint(2, "9term: host read error: %r\n");
@ -163,7 +163,7 @@ void
hoststart(void)
{
hostc = chancreate(sizeof(int), 0);
proccreate(hostproc, hostc, 32*1024);
threadcreate(hostproc, hostc, 32*1024);
}
void

View file

@ -196,6 +196,7 @@ plumblook(Plumbmsg *m)
openfile(nil, &e);
free(e.name);
free(e.u.at);
drawtopwindow();
}
void
@ -234,6 +235,7 @@ plumbshow(Plumbmsg *m)
winsettag(w);
textscrdraw(&w->body);
textsetselect(&w->tag, w->tag.file->b.nc, w->tag.file->b.nc);
drawtopwindow();
}
int

View file

@ -25,7 +25,7 @@ long invlong(int);
void hsetdot(int, long, long);
void hmoveto(int, long);
void hsetsnarf(int);
/* void hplumb(int); */
void hplumb(int);
void clrlock(void);
int snarfswap(char*, int, char**);
@ -296,11 +296,9 @@ inmesg(Hmesg type, int count)
threadexitsall(nil);
break;
/*
case Hplumb:
hplumb(m);
break;
*/
}
}
@ -668,7 +666,6 @@ hsetsnarf(int nc)
setcursor(mousectl, cursor);
}
/*
void
hplumb(int nc)
{
@ -687,7 +684,6 @@ hplumb(int nc)
}
free(s);
}
*/
void
hgrow(int m, long a, long new, int req)

View file

@ -23,6 +23,6 @@ HFILES=\
CFLAGS=$CFLAGS -I../sam
LDFLAGS=$LDFLAGS -L$X11/lib -lX11 -lm
SHORTLIB=frame draw thread regexp9 bio 9
SHORTLIB=frame draw plumb fs mux thread regexp9 bio 9
<$PLAN9/src/mkone

View file

@ -10,6 +10,7 @@
#include <cursor.h>
#include <keyboard.h>
#include <frame.h>
#include <plumb.h>
#include "flayer.h"
#include "samterm.h"
@ -170,20 +171,15 @@ extstart(void)
atexit(removeextern);
}
#if 0
int
plumbformat(int i)
plumbformat(Plumbmsg *m, int i)
{
Plumbmsg *m;
char *addr, *data, *act;
int n;
data = (char*)plumbbuf[i].data;
m = plumbunpack(data, plumbbuf[i].n);
if(m == nil)
return 0;
n = m->ndata;
if(n == 0){
if(n == 0 || 2+n+2 >= READBUFSIZE){
plumbfree(m);
return 0;
}
@ -219,8 +215,9 @@ void
plumbproc(void *argv)
{
Channel *c;
int i, n, which, *fdp;
int i, *fdp;
void **arg;
Plumbmsg *m;
arg = argv;
c = arg[0];
@ -229,16 +226,14 @@ plumbproc(void *argv)
i = 0;
threadfdnoblock(*fdp);
for(;;){
i = 1-i; /* toggle */
n = threadread(*fdp, plumbbuf[i].data, READBUFSIZE);
if(n <= 0){
m = threadplumbrecv(*fdp);
if(m == nil){
fprint(2, "samterm: plumb read error: %r\n");
threadexits("plumb"); /* not a fatal error */
}
plumbbuf[i].n = n;
if(plumbformat(i)){
which = i;
send(c, &which);
if(plumbformat(m, i)){
send(c, &i);
i = 1-i; /* toggle */
}
}
}
@ -258,18 +253,11 @@ plumbstart(void)
close(fd);
return -1;
}
arg[0] =plumbc;
arg[0] = plumbc;
arg[1] = &fd;
threadcreate(plumbproc, arg, STACK);
return 1;
}
#endif
int
plumbstart(void)
{
return -1;
}
void
hostproc(void *arg)

View file

@ -124,6 +124,8 @@ xerror(XDisplay *d, XErrorEvent *e)
{
char buf[200];
if(e->request_code == 42) /* XSetInputFocus */
return 0;
print("X error: error_code=%d, request_code=%d, minor=%d disp=%p\n",
e->error_code, e->request_code, e->minor_code, d);
XGetErrorText(d, e->error_code, buf, sizeof buf);

View file

@ -8,7 +8,10 @@
void
drawtopwindow(void)
{
XRaiseWindow(_x.display, _x.drawable);
XMapRaised(_x.display, _x.drawable);
XFlush(_x.display);
XSetInputFocus(_x.display, _x.drawable, RevertToPointerRoot,
CurrentTime);
XFlush(_x.display);
}