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