typedef struct Client Client;
typedef struct CScreen CScreen;
typedef struct Cursorinfo Cursorinfo;
typedef struct DImage DImage;
typedef struct DName DName;
typedef struct Draw Draw;
typedef struct DScreen DScreen;
typedef struct FChar FChar;
typedef struct Kmouse Kmouse;
typedef struct Mouseinfo Mouseinfo;
typedef struct Refresh Refresh;
typedef struct Refx Refx;
typedef struct Window Window;

struct Cursorinfo
{
	Cursor	c;
	Lock		lk;
};

struct Kmouse
{
	int		buttons;	/* bit array: LMR=124 */
	Point		xy;
	ulong	msec;
	ulong	counter;
};

struct Mouseinfo
{
	Kmouse	m;
	ulong	lastcounter;
	Rendez	r;
	Lock		lk;
	Ref		ref;
	QLock	qlk;
	int		open;
	int		queue[16];
	int		ri;
	int		wi;
	int		qfull;
	int		mresize;	/* number of resizes read from devmouse */
	int		nresize;	/* number of resizes */
};

struct Window
{
	Ref			ref;
	int			id;
	char			name[40];
	char			*wdir;
	int			nresize;

	/* devcons state */

	/* devmouse state */
	int			mouseshifted;
	Mouseinfo 	mouse;
	Cursorinfo 	cursor;

	/* devdraw state */
	Rectangle		flushrect;
	Memimage*	image;
	int			waste;
	int			softscreen;
};

extern	void		addwindow(Window*);
extern	void		deletewindow(Window*);
extern	void		flushmemscreen(Window*, Rectangle);
extern	void		mousetrack(Window*, Mouse);
extern	void		mouseresize(Window*);
extern	Point		mousexy(Window*);
extern	void		movecursor(Window*, Point);
extern	void		resizewindow(Window*);
extern	void		setcolor(ulong, ulong, ulong, ulong);
