vgamouse.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #define MOUSE_MICROSOFT 0
  2. #define MOUSE_MOUSESYSTEMS 1
  3. #define MOUSE_MMSERIES 2
  4. #define MOUSE_LOGITECH 3
  5. #define MOUSE_BUSMOUSE 4
  6. #define MOUSE_PS2 5
  7. #define MOUSE_LOGIMAN 6
  8. #define MOUSE_GPM 7
  9. #define MOUSE_SPACEBALL 8
  10. #define MOUSE_ORIENTATION_VERTICAL 0
  11. #define MOUSE_ORIENTATION_HORIZONTAL 1
  12. /* Logical or the following values to one of the above at will and give that for
  13. type in mouse_init (still they make only sense for serial mice) */
  14. #define MOUSE_CHG_DTR 0x80000000 /* CLEAR (!) the DTR line */
  15. #define MOUSE_DTR_HIGH 0x40000000 /* when used with MOUSE_CHG_DTR set DTR not clear it */
  16. #define MOUSE_CHG_RTS 0x20000000 /* CLEAR (!) the RTS line */
  17. #define MOUSE_RTS_HIGH 0x10000000 /* when used with MOUSE_CHG_RTS set RTS not clear it */
  18. /* If MOUSE_CHG_DTR is not given the DTR state is not touched.. same with RTS resp. */
  19. /* So I use MOUSE_MOUSESYSTEMS|MOUSE_CHG_RTS to force my
  20. multiprotocol mouse to MOUSESYSTEMS and use init the driver to MOUSESYSTEMS */
  21. #define MOUSE_TYPE_MASK 0xffff /* the upper 16bit are reserved for future flags */
  22. #define MOUSE_LEFTBUTTON 4
  23. #define MOUSE_MIDDLEBUTTON 2
  24. #define MOUSE_RIGHTBUTTON 1
  25. #define MOUSE_FOURTHBUTTON 8
  26. #define MOUSE_FIFTHBUTTON 16
  27. #define MOUSE_SIXTHBUTTON 32
  28. #define MOUSE_RESETBUTTON 64
  29. #define MOUSE_XDIM 1
  30. #define MOUSE_YDIM 2
  31. #define MOUSE_ZDIM 4
  32. #define MOUSE_RXDIM 8
  33. #define MOUSE_RYDIM 16
  34. #define MOUSE_RZDIM 32
  35. #define MOUSE_2DIM 3
  36. #define MOUSE_3DIM 7
  37. #define MOUSE_6DIM 63
  38. #define MOUSE_DEFAULTSAMPLERATE 150
  39. /* Initialize mouse device. Returns 0 if succesful, -1 otherwise. */
  40. /* (Get the svgalib configured type with vga_getmousetype()). */
  41. int mouse_init(char *dev, int type, int samplerate);
  42. /* Similar but returns the mouse fd if succesful. */
  43. int mouse_init_return_fd(char *dev, int type, int samplerate);
  44. /* Set event handler invoked by mouse_update(). */
  45. #if 0 /* This is the actual definition */
  46. typedef void (*__mouse_handler) (int button, int dx, int dy, int dz,
  47. int drx, int dry, int drz);
  48. #else /* For backwards compatibility with:
  49. typedef void (*__mouse_handler) (int button, int dx, int dy) we use: */
  50. typedef void *__mouse_handler;
  51. #endif
  52. void mouse_seteventhandler(__mouse_handler handler);
  53. /* Close mouse device. */
  54. void mouse_close(void);
  55. /* Read mouse and handle events. Returns 0 if no event. */
  56. int mouse_update(void);
  57. /* Similar to mouse_update, but wait for an event to happen. */
  58. void mouse_waitforupdate(void);
  59. /* mouse_init sets default event handler that keeps track of absolute */
  60. /* coordinates: */
  61. #define MOUSE_NOWRAP 0
  62. #define MOUSE_WRAPX 1
  63. #define MOUSE_WRAPY 2
  64. #define MOUSE_WRAPZ 4
  65. #define MOUSE_WRAPRX 8
  66. #define MOUSE_WRAPRY 16
  67. #define MOUSE_WRAPRZ 32
  68. #define MOUSE_WRAP 63
  69. #define MOUSE_ROT_COORDS 196
  70. #define MOUSE_ROT_INFINITESIMAL 0 /* report changes in angle about axes */
  71. #define MOUSE_ROT_RX_RY_RZ 64 /* report angle about axes */
  72. /* Warning! Next two not yet supported! */
  73. #define MOUSE_ROT_ZXZ 128 /* use x convention Euler angles */
  74. #define MOUSE_ROT_YPR 196 /* use yaw, pitch, and roll */
  75. /* Revert to default handler. */
  76. void mouse_setdefaulteventhandler(void);
  77. /* Set position of mouse. */
  78. void mouse_setposition(int x, int y);
  79. /* Set position of mouse in all 6 dimensions. */
  80. void mouse_setposition_6d(int x, int y, int z,
  81. int rx, int ry, int rz, int dim_mask);
  82. /* Set horizontal range of mouse to [x1, x2] incl. */
  83. void mouse_setxrange(int x1, int x2);
  84. /* Set vertical range of mouse to [y1, y2] incl. */
  85. void mouse_setyrange(int y1, int y2);
  86. /* Set all ranges of mouse in 6 dimensions. */
  87. void mouse_setrange_6d(int x1, int x2, int y1, int y2, int z1, int z2,
  88. int rx1, int rx2, int ry1, int ry2, int rz1, int rz2, int dim_mask);
  89. /* Set scale factor by which raw mouse coordinates are divided. */
  90. void mouse_setscale(int s);
  91. /* Enable/disable wrapping of mouse in horizontal and/or vertical range. */
  92. void mouse_setwrap(int w);
  93. /* Get current mouse x-coordinate. */
  94. int mouse_getx(void);
  95. /* Get current mouse y-coordinate. */
  96. int mouse_gety(void);
  97. /* Get position of mouse in all 6 dimensions. */
  98. void mouse_getposition_6d(int *x, int *y, int *z,
  99. int *rx, int *ry, int *rz);
  100. /* Get current mouse button status. */
  101. int mouse_getbutton(void);