Blob


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;
9 struct Mouse
10 {
11 int buttons; /* bit array: LMR=124 */
12 Point xy;
13 ulong msec;
14 };
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 */
23 char *file;
24 int mfd; /* to mouse file */
25 int cfd; /* to cursor file */
26 int pid; /* of slave proc */
27 Display *display;
28 /*Image* image; / * of associated window/display */
30 /* clumsy hack for X11 */
31 struct Channel *ccursor;
32 struct Channel *ccursorwait;
33 QLock cursorlock;
34 };
36 struct Menu
37 {
38 char **item;
39 char *(*gen)(int);
40 int lasthit;
41 };
43 /*
44 * Mouse
45 */
46 extern Mousectl* initmouse(char*, Image*);
47 extern void moveto(Mousectl*, Point);
48 extern int readmouse(Mousectl*);
49 extern void closemouse(Mousectl*);
50 struct Cursor;
51 extern void setcursor(Mousectl*, struct Cursor*);
52 extern void drawgetrect(Rectangle, int);
53 extern Rectangle getrect(int, Mousectl*);
54 extern int menuhit(int, Mousectl*, Menu*, Screen*);
56 extern void bouncemouse(Mouse*);
57 extern int _windowhasfocus; /* XXX do better */
58 extern int _wantfocuschanges;
60 #if defined(__cplusplus)
61 }
62 #endif
63 #endif