forked from shabble/mouseterm
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Mouse.h
65 lines (56 loc) · 1.43 KB
/
Mouse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Possible mouse modes
typedef enum
{
NO_MODE = 0,
X10_MODE = 1,
NORMAL_MODE = 2,
HILITE_MODE = 3,
BUTTON_MODE = 4,
ALL_MODE = 5,
DEC_LOCATOR_MODE = 6,
DEC_LOCATOR_ONESHOT_MODE = 7,
} MouseMode;
typedef enum
{
NORMAL_PROTOCOL = 0,
URXVT_PROTOCOL = 1,
SGR_PROTOCOL = 2,
LOCATOR_PROTOCOL = 3,
} MouseProtocol;
typedef enum
{
CELL_COORDINATE = 0,
PIXEL_COORDINATE = 1,
} CoordinateType;
typedef enum
{
REQUEST_EVENT = 0x0,
BUTTONDOWN_EVENT = 0x1,
BUTTONUP_EVENT = 0x2,
} LocatorEventFilter;
// Control codes
#define PDA_RESPONSE "\033[?1;22;29c"
#define PDA_RESPONSE_LEN (sizeof(PDA_RESPONSE) - 1)
// MT(0x4d54 => 19796) ver 1.0.0(10000)
#define SDA_RESPONSE "\033[>19796;10000;2c"
#define SDA_RESPONSE_LEN (sizeof(SDA_RESPONSE) - 1)
// Normal control codes
#define UP_ARROW "\033[A"
#define DOWN_ARROW "\033[B"
// Control codes for application keypad mode
#define UP_ARROW_APP "\033OA"
#define DOWN_ARROW_APP "\033OB"
#define ARROW_LEN (sizeof(UP_ARROW) - 1)
// X11 mouse button values
typedef enum
{
MOUSE_BUTTON1 = 0,
MOUSE_BUTTON3 = 1,
MOUSE_BUTTON2 = 2,
MOUSE_RELEASE = 3,
MOUSE_WHEEL_UP = 64,
MOUSE_WHEEL_DOWN = 65,
} MouseButton;
// X11 mouse reporting responses
#define MOUSE_RESPONSE "\033[M%c%c%c"
#define MOUSE_RESPONSE_LEN 6