1
0

mouse.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. typedef struct Channel Channel;
  10. typedef struct Cursor Cursor;
  11. typedef struct Menu Menu;
  12. typedef struct Mousectl Mousectl;
  13. /* as a way to get sort-of anon structs, we make the Mouse and Mousectl structs
  14. * interchangeable.
  15. */
  16. struct Mouse
  17. {
  18. int buttons; /* bit array: LMR=124 */
  19. Point xy;
  20. u32 msec;
  21. };
  22. struct Mousectl
  23. {
  24. //Mouse;
  25. int buttons; /* bit array: LMR=124 */
  26. Point xy;
  27. u32 msec;
  28. Channel *c; /* chan(Mouse) */
  29. Channel *resizec; /* chan(int)[2] */
  30. /* buffered in case client is waiting for a mouse action before handling resize */
  31. char *file;
  32. int mfd; /* to mouse file */
  33. int cfd; /* to cursor file */
  34. int pid; /* of slave proc */
  35. Image* image; /* of associated window/display */
  36. };
  37. struct Menu
  38. {
  39. char **item;
  40. char *(*gen)(int);
  41. int lasthit;
  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. extern void setcursor(Mousectl*, Cursor*);
  51. extern void drawgetrect(Rectangle, int);
  52. extern Rectangle getrect(int, Mousectl*);
  53. extern int menuhit(int, Mousectl*, Menu*, Screen*);
  54. extern void setmenucolor(u32 backcolor, u32 highcolor, u32 bordercolor,
  55. u32 textcolor, u32 seltextcolor);