[NTVDM]
[reactos.git] / reactos / subsystems / ntvdm / hardware / mouse.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: mouse.h
5 * PURPOSE: Mouse emulation
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _MOUSE_H_
10 #define _MOUSE_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "ntvdm.h"
15
16 /* DEFINES ********************************************************************/
17
18 /* Mouse packet constants */
19 #define MOUSE_MIN -256
20 #define MOUSE_MAX 255
21 #define MOUSE_SIGN_BIT (1 << 8)
22
23 /* Mouse packet flags */
24 #define MOUSE_LEFT_BUTTON (1 << 0)
25 #define MOUSE_RIGHT_BUTTON (1 << 1)
26 #define MOUSE_MIDDLE_BUTTON (1 << 2)
27 #define MOUSE_ALWAYS_SET (1 << 3)
28 #define MOUSE_X_SIGN (1 << 4)
29 #define MOUSE_Y_SIGN (1 << 5)
30 #define MOUSE_X_OVERFLOW (1 << 6)
31 #define MOUSE_Y_OVERFLOW (1 << 7)
32
33 /* Mouse packet extra flags */
34 #define MOUSE_4TH_BUTTON (1 << 4)
35 #define MOUSE_5TH_BUTTON (1 << 5)
36
37 /* Command responses */
38 #define MOUSE_BAT_SUCCESS 0xAA
39 #define MOUSE_ACK 0xFA
40 #define MOUSE_ERROR 0xFC
41
42 /*
43 * Scrolling directions
44 *
45 * It may seem odd that the directions are implemented this way, but
46 * this is how it's done on real hardware. It works because the two
47 * scroll wheels can't be used at the same time.
48 */
49 #define MOUSE_SCROLL_UP 1
50 #define MOUSE_SCROLL_DOWN -1
51 #define MOUSE_SCROLL_RIGHT 2
52 #define MOUSE_SCROLL_LET -2
53
54 typedef enum _MOUSE_MODE
55 {
56 MOUSE_STREAMING_MODE,
57 MOUSE_REMOTE_MODE,
58 MOUSE_WRAP_MODE,
59 } MOUSE_MODE, *PMOUSE_MODE;
60
61 typedef struct _MOUSE_PACKET
62 {
63 BYTE Flags;
64 BYTE HorzCounter;
65 BYTE VertCounter;
66 BYTE Extra;
67 } MOUSE_PACKET, *PMOUSE_PACKET;
68
69 /* FUNCTIONS ******************************************************************/
70
71 VOID MouseUpdatePosition(PCOORD NewPosition);
72 VOID MouseUpdateButtons(ULONG NewButtonState);
73 VOID MouseScroll(LONG Direction);
74 COORD MouseGetPosition(VOID);
75 VOID MouseCommand(BYTE Command);
76 BOOLEAN MouseInit(VOID);
77
78 #endif // _MOUSE_H_