blob: 9b563faf467362bbb86e0f5bead98dfa8638d635 [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 */
29};
30
31struct Menu
32{
33 char **item;
34 char *(*gen)(int);
35 int lasthit;
36};
37
38/*
39 * Mouse
40 */
41extern Mousectl* initmouse(char*, Image*);
42extern void moveto(Mousectl*, Point);
43extern int readmouse(Mousectl*);
44extern void closemouse(Mousectl*);
45struct Cursor;
46extern void setcursor(Mousectl*, struct Cursor*);
47extern void drawgetrect(Rectangle, int);
48extern Rectangle getrect(int, Mousectl*);
49extern int menuhit(int, Mousectl*, Menu*, Screen*);
rscf7012582003-11-25 01:40:27 +000050
rsc4f30f3b2004-03-30 05:03:29 +000051extern void bouncemouse(Mouse*);
52extern int _windowhasfocus; /* XXX do better */
53extern int _wantfocuschanges;
rscf7012582003-11-25 01:40:27 +000054
55#if defined(__cplusplus)
56}
57#endif
58#endif