enum
{
Selborder = 4, /* border of selected window */
Unselborder = 1, /* border of unselected window */
Scrollwid = 12, /* width of scroll bar */
Scrollgap = 4, /* gap right of scroll bar */
BIG = 3, /* factor by which window dimension can exceed screen */
TRUE = 1,
FALSE = 0,
};
struct Stringpair /* rune and nrune or byte and nbyte */
{
void *s;
int ns;
};
struct Mousestate
{
Mouse;
ulong counter; /* serial no. of mouse event */
};
struct Mouseinfo
{
Mousestate queue[16];
int ri; /* read index into queue */
int wi; /* write index */
ulong counter; /* serial no. of last mouse event we received */
ulong lastcounter; /* serial no. of last mouse event sent to client */
int lastb; /* last button state we received */
uchar qfull; /* filled the queue; no more recording until client comes back */
};
struct Window
{
Ref;
QLock;
Frame;
Image *i;
Mousectl mc;
Mouseinfo mouse;
Channel *ck; /* chan(Rune[10]) */
Channel *cctl; /* chan(Wctlmesg)[20] */
Channel *conswrite; /* chan(Conswritemesg) */
Channel *consread; /* chan(Consreadmesg) */
Channel *mouseread; /* chan(Mousereadmesg) */
Channel *wctlread; /* chan(Consreadmesg) */
uint nr; /* number of runes in window */
uint maxr; /* number of runes allocated in r */
Rune *r;
uint nraw;
Rune *raw;
uint org;
uint q0;
uint q1;
uint qh;
int id;
char name[32];
uint namecount;
Rectangle scrollr;
/*
* Rio once used originwindow, so screenr could be different from i->r.
* Now they're always the same but the code doesn't assume so.
*/
Rectangle screenr; /* screen coordinates of window */
int resized;
int wctlready;
Rectangle lastsr;
int topped;
int notefd;
uchar scrolling;
Cursor cursor;
Cursor *cursorp;
uchar holding;
uchar rawing;
uchar ctlopen;
uchar wctlopen;
uchar deleted;
uchar mouseopen;
char *label;
int pid;
char *dir;
};
struct Fid
{
int fid;
int busy;
int open;
int mode;
Qid qid;
Window *w;
Dirtab *dir;
Fid *next;
int nrpart;
uchar rpart[UTFmax];
};
struct Xfid
{
Ref;
Xfid *next;
Xfid *free;
Fcall;
Channel *c; /* chan(void(*)(Xfid*)) */
Fid *f;
uchar *buf;
Filsys *fs;
QLock active;
int flushing; /* another Xfid is trying to flush us */
int flushtag; /* our tag, so flush can find us */
Channel *flushc; /* channel(int) to notify us we're being flushed */
};
struct Timer
{
int dt;
int cancel;
Channel *c; /* chan(int) */
Timer *next;
};
Font *font;
Mousectl *mousectl;
Mouse *mouse;
Keyboardctl *keyboardctl;
Display *display;
Image *view;
Screen *wscreen;
Cursor boxcursor;
Cursor crosscursor;
Cursor sightcursor;
Cursor whitearrow;
Cursor query;
Cursor *corners[9];
Image *background;
Image *lightgrey;
Image *red;
Window **window;
Window *wkeyboard; /* window of simulated keyboard */
int nwindow;
int snarffd;
Window *input;
QLock all; /* BUG */
Filsys *filsys;
Window *hidden[100];
int nhidden;
int nsnarf;
Rune* snarf;
int scrolling;
int maxtab;
Channel* winclosechan;
Channel* deletechan;
char *startdir;
int sweeping;
int wctlfd;
char srvpipe[];
char srvwctl[];
int errorshouldabort;
int menuing; /* menu action is pending; waiting for window to be indicated */
int snarfversion; /* updated each time it is written */
int messagesize; /* negotiated in 9P version setup */