]> git.lizzy.rs Git - plan9front.git/blob - sys/include/mouse.h
libFLAC/mkfile: update version and build with -DNDEBUG
[plan9front.git] / sys / include / mouse.h
1 #pragma src "/sys/src/libdraw"
2
3 typedef struct  Channel Channel;
4 typedef struct  Cursor Cursor;
5 typedef struct  Menu Menu;
6 typedef struct  Mousectl Mousectl;
7 typedef struct  Keyboardctl Keyboardctl;
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;
19         Channel *c;     /* chan(Mouse) */
20         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         Image*  image;  /* of associated window/display */
28 };
29
30 struct Menu
31 {
32         char    **item;
33         char    *(*gen)(int);
34         int     lasthit;
35 };
36
37 /*
38  * Mouse
39  */
40 extern Mousectl*        initmouse(char*, Image*);
41 extern void             moveto(Mousectl*, Point);
42 extern int                      readmouse(Mousectl*);
43 extern void             closemouse(Mousectl*);
44 extern void             setcursor(Mousectl*, Cursor*);
45 extern void             drawgetrect(Rectangle, int);
46 extern Rectangle        getrect(int, Mousectl*);
47 extern int                      menuhit(int, Mousectl*, Menu*, Screen*);
48 extern int              enter(char *, char *, int, Mousectl*, Keyboardctl*, Screen*);