1 #ifndef _MOUSE_H_
2 #define _MOUSE_H_ 1
3 #if defined(__cplusplus)
4 extern "C" {
5 #endif
6 typedef struct	Menu Menu;
7 typedef struct 	Mousectl Mousectl;
8 
9 struct	Mouse
10 {
11 	int	buttons;	/* bit array: LMR=124 */
12 	Point	xy;
13 	ulong	msec;
14 };
15 
16 struct 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 
23 	Display		*display;	/* associated display */
24 };
25 
26 struct Menu
27 {
28 	char	**item;
29 	char	*(*gen)(int);
30 	int	lasthit;
31 };
32 
33 /*
34  * Mouse
35  */
36 extern Mousectl*	initmouse(char*, Image*);
37 extern void		moveto(Mousectl*, Point);
38 extern int			readmouse(Mousectl*);
39 extern void		closemouse(Mousectl*);
40 struct Cursor;
41 struct Cursor2;
42 extern void		setcursor(Mousectl*, struct Cursor*);
43 extern void		setcursor2(Mousectl*, struct Cursor*, struct Cursor2*);
44 extern void		drawgetrect(Rectangle, int);
45 extern Rectangle	getrect(int, Mousectl*);
46 extern int	 		menuhit(int, Mousectl*, Menu*, Screen*);
47 
48 extern void		bouncemouse(Mouse*);
49 extern int			_windowhasfocus;	/* XXX do better */
50 extern int			_wantfocuschanges;
51 
52 #if defined(__cplusplus)
53 }
54 #endif
55 #endif
56