rsc | f701258 | 2003-11-25 01:40:27 +0000 | [diff] [blame] | 1 | #ifndef _MOUSE_H_ |
| 2 | #define _MOUSE_H_ 1 |
| 3 | #if defined(__cplusplus) |
| 4 | extern "C" { |
| 5 | #endif |
rsc | b2cfc4e | 2003-09-30 17:47:41 +0000 | [diff] [blame] | 6 | typedef struct Menu Menu; |
| 7 | typedef struct Mousectl Mousectl; |
| 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 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 */ |
rsc | dd4afdf | 2005-02-08 17:56:35 +0000 | [diff] [blame] | 29 | |
| 30 | /* clumsy hack for X11 */ |
| 31 | struct Channel *ccursor; |
| 32 | struct Channel *ccursorwait; |
| 33 | QLock cursorlock; |
rsc | b2cfc4e | 2003-09-30 17:47:41 +0000 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | struct Menu |
| 37 | { |
| 38 | char **item; |
| 39 | char *(*gen)(int); |
| 40 | int lasthit; |
| 41 | }; |
| 42 | |
| 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*); |
rsc | f701258 | 2003-11-25 01:40:27 +0000 | [diff] [blame] | 55 | |
rsc | 4f30f3b | 2004-03-30 05:03:29 +0000 | [diff] [blame] | 56 | extern void bouncemouse(Mouse*); |
| 57 | extern int _windowhasfocus; /* XXX do better */ |
| 58 | extern int _wantfocuschanges; |
rsc | f701258 | 2003-11-25 01:40:27 +0000 | [diff] [blame] | 59 | |
| 60 | #if defined(__cplusplus) |
| 61 | } |
| 62 | #endif |
| 63 | #endif |