blob: 3d5c975fe452796d089434d66f0424fd4da1340f [file] [log] [blame]
rscf7012582003-11-25 01:40:27 +00001#ifndef _MOUSE_H_
2#define _MOUSE_H_ 1
3#if defined(__cplusplus)
4extern "C" {
5#endif
rscb2cfc4e2003-09-30 17:47:41 +00006typedef struct Menu Menu;
7typedef struct Mousectl Mousectl;
8
9struct Mouse
10{
11 int buttons; /* bit array: LMR=124 */
12 Point xy;
13 ulong msec;
14};
15
16struct Mousectl
17{
18 Mouse m;
19 struct Channel *c; /* chan(Mouse) */
20 struct Channel *resizec; /* chan(int)[2] */
21 /* buffered in case client is waiting for a mouse action before handling resize */
22
rscd2397382006-06-25 23:49:43 +000023 Display *display; /* associated display */
rscb2cfc4e2003-09-30 17:47:41 +000024};
25
26struct Menu
27{
28 char **item;
29 char *(*gen)(int);
30 int lasthit;
31};
32
33/*
34 * Mouse
35 */
36extern Mousectl* initmouse(char*, Image*);
37extern void moveto(Mousectl*, Point);
38extern int readmouse(Mousectl*);
39extern void closemouse(Mousectl*);
40struct Cursor;
41extern void setcursor(Mousectl*, struct Cursor*);
42extern void drawgetrect(Rectangle, int);
43extern Rectangle getrect(int, Mousectl*);
44extern int menuhit(int, Mousectl*, Menu*, Screen*);
rscf7012582003-11-25 01:40:27 +000045
rsc4f30f3b2004-03-30 05:03:29 +000046extern void bouncemouse(Mouse*);
47extern int _windowhasfocus; /* XXX do better */
48extern int _wantfocuschanges;
rscf7012582003-11-25 01:40:27 +000049
50#if defined(__cplusplus)
51}
52#endif
53#endif