xref: /reactos/subsystems/mvdm/ntvdm/hardware/mouse.h (revision c2c66aff)
1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/hardware/mouse.h
5  * PURPOSE:         PS/2 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 /* DEFINES ********************************************************************/
13 
14 /* Mouse packet constants */
15 #define MOUSE_MAX 255
16 
17 /* Mouse packet flags */
18 #define MOUSE_LEFT_BUTTON   (1 << 0)
19 #define MOUSE_RIGHT_BUTTON  (1 << 1)
20 #define MOUSE_MIDDLE_BUTTON (1 << 2)
21 #define MOUSE_ALWAYS_SET    (1 << 3)
22 #define MOUSE_X_SIGN        (1 << 4)
23 #define MOUSE_Y_SIGN        (1 << 5)
24 #define MOUSE_X_OVERFLOW    (1 << 6)
25 #define MOUSE_Y_OVERFLOW    (1 << 7)
26 
27 /* Mouse packet extra flags */
28 #define MOUSE_4TH_BUTTON    (1 << 4)
29 #define MOUSE_5TH_BUTTON    (1 << 5)
30 
31 /* Command responses */
32 #define MOUSE_BAT_SUCCESS   0xAA
33 #define MOUSE_ACK           0xFA
34 #define MOUSE_ERROR         0xFC
35 
36 /*
37  * Scrolling directions
38  *
39  * It may seem odd that the directions are implemented this way, but
40  * this is how it's done on real hardware. It works because the two
41  * scroll wheels can't be used at the same time.
42  */
43 #define MOUSE_SCROLL_UP     1
44 #define MOUSE_SCROLL_DOWN  -1
45 #define MOUSE_SCROLL_RIGHT  2
46 #define MOUSE_SCROLL_LEFT  -2
47 
48 typedef enum _MOUSE_MODE
49 {
50     MOUSE_STREAMING_MODE,
51     MOUSE_REMOTE_MODE,
52     MOUSE_WRAP_MODE,
53 } MOUSE_MODE, *PMOUSE_MODE;
54 
55 typedef struct _MOUSE_PACKET
56 {
57     BYTE Flags;
58     BYTE HorzCounter;
59     BYTE VertCounter;
60     BYTE Extra;
61 } MOUSE_PACKET, *PMOUSE_PACKET;
62 
63 /* FUNCTIONS ******************************************************************/
64 
65 VOID MouseEventHandler(PMOUSE_EVENT_RECORD MouseEvent);
66 VOID MouseGetDataFast(PCOORD CurrentPosition, PBYTE CurrentButtonState);
67 BOOLEAN MouseInit(BYTE PS2Connector);
68 
69 #endif /* _MOUSE_H_ */
70