blob: ce69c8ea8d007916490f9e70fbed1f13a7e129e8 [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
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 */
rscdd4afdf2005-02-08 17:56:35 +000029
30 /* clumsy hack for X11 */
31 struct Channel *ccursor;
32 struct Channel *ccursorwait;
33 QLock cursorlock;
rscb2cfc4e2003-09-30 17:47:41 +000034};
35
36struct Menu
37{
38 char **item;
39 char *(*gen)(int);
40 int lasthit;
41};
42
43/*
44 * Mouse
45 */
46extern Mousectl* initmouse(char*, Image*);
47extern void moveto(Mousectl*, Point);
48extern int readmouse(Mousectl*);
49extern void closemouse(Mousectl*);
50struct Cursor;
51extern void setcursor(Mousectl*, struct Cursor*);
52extern void drawgetrect(Rectangle, int);
53extern Rectangle getrect(int, Mousectl*);
54extern int menuhit(int, Mousectl*, Menu*, Screen*);
rscf7012582003-11-25 01:40:27 +000055
rsc4f30f3b2004-03-30 05:03:29 +000056extern void bouncemouse(Mouse*);
57extern int _windowhasfocus; /* XXX do better */
58extern int _wantfocuschanges;
rscf7012582003-11-25 01:40:27 +000059
60#if defined(__cplusplus)
61}
62#endif
63#endif