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 8 struct Mouse 9 { 10 int buttons; /* bit array: LMR=124 */ 11 Point xy; 12 ulong msec; 13 }; 14 15 struct Mousectl 16 { 17 Mouse; 18 Channel *c; /* chan(Mouse) */ 19 Channel *resizec; /* chan(int)[2] */ 20 /* buffered in case client is waiting for a mouse action before handling resize */ 21 22 char *file; 23 int mfd; /* to mouse file */ 24 int cfd; /* to cursor file */ 25 int pid; /* of slave proc */ 26 Image* image; /* of associated window/display */ 27 }; 28 29 struct Menu 30 { 31 char **item; 32 char *(*gen)(int); 33 int lasthit; 34 }; 35 36 /* 37 * Mouse 38 */ 39 extern Mousectl* initmouse(char*, Image*); 40 extern void moveto(Mousectl*, Point); 41 extern int readmouse(Mousectl*); 42 extern void closemouse(Mousectl*); 43 extern void setcursor(Mousectl*, Cursor*); 44 extern void drawgetrect(Rectangle, int); 45 extern Rectangle getrect(int, Mousectl*); 46 extern int menuhit(int, Mousectl*, Menu*, Screen*); 47