root / lab4 / .minix-src / include / minix / keymap.h @ 13
History | View | Annotate | Download (4.41 KB)
1 | 13 | up20180614 | /* keymap.h - defines for keymapping Author: Marcus Hampel
|
---|---|---|---|
2 | */
|
||
3 | #ifndef _SYS__KEYMAP_H
|
||
4 | #define _SYS__KEYMAP_H
|
||
5 | |||
6 | #define K(k) [INPUT_KEY_ ## k] /* Map to key entry */ |
||
7 | |||
8 | #define C(c) ((c) & 0x1F) /* Map to control code */ |
||
9 | #define A(c) ((c) | 0x80) /* Set eight bit (ALT) */ |
||
10 | #define CA(c) A(C(c)) /* Control-Alt */ |
||
11 | #define N(c) ((c) | HASNUM) /* Add "Num Lock has effect" attribute */ |
||
12 | #define L(c) ((c) | HASCAPS) /* Add "Caps Lock has effect" attribute */ |
||
13 | |||
14 | #define EXT 0x0100 /* Normal function keys */ |
||
15 | #define CTRLKEY 0x0200 /* Control key */ |
||
16 | #define SHIFT 0x0400 /* Shift key */ |
||
17 | #define ALT 0x0800 /* Alternate key */ |
||
18 | #define HASNUM 0x4000 /* Num Lock has effect */ |
||
19 | #define HASCAPS 0x8000 /* Caps Lock has effect */ |
||
20 | |||
21 | /* The left and right versions for the actual keys in the keymap. */
|
||
22 | #define LCTRL CTRLKEY
|
||
23 | #define RCTRL (CTRLKEY | EXT)
|
||
24 | #define LSHIFT SHIFT
|
||
25 | #define RSHIFT (SHIFT | EXT)
|
||
26 | #define LALT ALT
|
||
27 | #define RALT (ALT | EXT)
|
||
28 | |||
29 | /* Delete key */
|
||
30 | #define DEL 0177 |
||
31 | |||
32 | /* Numeric keypad */
|
||
33 | #define HOME (0x01 + EXT) |
||
34 | #define END (0x02 + EXT) |
||
35 | #define UP (0x03 + EXT) |
||
36 | #define DOWN (0x04 + EXT) |
||
37 | #define LEFT (0x05 + EXT) |
||
38 | #define RIGHT (0x06 + EXT) |
||
39 | #define PGUP (0x07 + EXT) |
||
40 | #define PGDN (0x08 + EXT) |
||
41 | #define MID (0x09 + EXT) |
||
42 | /* UNUSED (0x0A + EXT) */
|
||
43 | /* UNUSED (0x0B + EXT) */
|
||
44 | #define INSRT (0x0C + EXT) |
||
45 | |||
46 | /* Keys affected by Num Lock */
|
||
47 | #define NHOME N(HOME)
|
||
48 | #define NEND N(END)
|
||
49 | #define NUP N(UP)
|
||
50 | #define NDOWN N(DOWN)
|
||
51 | #define NLEFT N(LEFT)
|
||
52 | #define NRIGHT N(RIGHT)
|
||
53 | #define NPGUP N(PGUP)
|
||
54 | #define NPGDN N(PGDN)
|
||
55 | #define NMID N(MID)
|
||
56 | #define NINSRT N(INSRT)
|
||
57 | #define NDEL N(DEL)
|
||
58 | |||
59 | /* Alt + Numeric keypad */
|
||
60 | #define AHOME (0x01 + ALT) |
||
61 | #define AEND (0x02 + ALT) |
||
62 | #define AUP (0x03 + ALT) |
||
63 | #define ADOWN (0x04 + ALT) |
||
64 | #define ALEFT (0x05 + ALT) |
||
65 | #define ARIGHT (0x06 + ALT) |
||
66 | #define APGUP (0x07 + ALT) |
||
67 | #define APGDN (0x08 + ALT) |
||
68 | #define AMID (0x09 + ALT) |
||
69 | #define AMIN (0x0A + ALT) |
||
70 | #define APLUS (0x0B + ALT) |
||
71 | #define AINSRT (0x0C + ALT) |
||
72 | |||
73 | /* Ctrl + Numeric keypad */
|
||
74 | #define CHOME (0x01 + CTRLKEY) |
||
75 | #define CEND (0x02 + CTRLKEY) |
||
76 | #define CUP (0x03 + CTRLKEY) |
||
77 | #define CDOWN (0x04 + CTRLKEY) |
||
78 | #define CLEFT (0x05 + CTRLKEY) |
||
79 | #define CRIGHT (0x06 + CTRLKEY) |
||
80 | #define CPGUP (0x07 + CTRLKEY) |
||
81 | #define CPGDN (0x08 + CTRLKEY) |
||
82 | #define CMID (0x09 + CTRLKEY) |
||
83 | #define CNMIN (0x0A + CTRLKEY) |
||
84 | #define CPLUS (0x0B + CTRLKEY) |
||
85 | #define CINSRT (0x0C + CTRLKEY) |
||
86 | |||
87 | /* Lock keys */
|
||
88 | #define CALOCK (0x0D + EXT) /* caps lock */ |
||
89 | #define NLOCK (0x0E + EXT) /* number lock */ |
||
90 | #define SLOCK (0x0F + EXT) /* scroll lock */ |
||
91 | |||
92 | /* Function keys */
|
||
93 | #define F1 (0x10 + EXT) |
||
94 | #define F2 (0x11 + EXT) |
||
95 | #define F3 (0x12 + EXT) |
||
96 | #define F4 (0x13 + EXT) |
||
97 | #define F5 (0x14 + EXT) |
||
98 | #define F6 (0x15 + EXT) |
||
99 | #define F7 (0x16 + EXT) |
||
100 | #define F8 (0x17 + EXT) |
||
101 | #define F9 (0x18 + EXT) |
||
102 | #define F10 (0x19 + EXT) |
||
103 | #define F11 (0x1A + EXT) |
||
104 | #define F12 (0x1B + EXT) |
||
105 | |||
106 | /* Alt+Fn */
|
||
107 | #define AF1 (0x10 + ALT) |
||
108 | #define AF2 (0x11 + ALT) |
||
109 | #define AF3 (0x12 + ALT) |
||
110 | #define AF4 (0x13 + ALT) |
||
111 | #define AF5 (0x14 + ALT) |
||
112 | #define AF6 (0x15 + ALT) |
||
113 | #define AF7 (0x16 + ALT) |
||
114 | #define AF8 (0x17 + ALT) |
||
115 | #define AF9 (0x18 + ALT) |
||
116 | #define AF10 (0x19 + ALT) |
||
117 | #define AF11 (0x1A + ALT) |
||
118 | #define AF12 (0x1B + ALT) |
||
119 | |||
120 | /* Ctrl+Fn */
|
||
121 | #define CF1 (0x10 + CTRLKEY) |
||
122 | #define CF2 (0x11 + CTRLKEY) |
||
123 | #define CF3 (0x12 + CTRLKEY) |
||
124 | #define CF4 (0x13 + CTRLKEY) |
||
125 | #define CF5 (0x14 + CTRLKEY) |
||
126 | #define CF6 (0x15 + CTRLKEY) |
||
127 | #define CF7 (0x16 + CTRLKEY) |
||
128 | #define CF8 (0x17 + CTRLKEY) |
||
129 | #define CF9 (0x18 + CTRLKEY) |
||
130 | #define CF10 (0x19 + CTRLKEY) |
||
131 | #define CF11 (0x1A + CTRLKEY) |
||
132 | #define CF12 (0x1B + CTRLKEY) |
||
133 | |||
134 | /* Shift+Fn */
|
||
135 | #define SF1 (0x10 + SHIFT) |
||
136 | #define SF2 (0x11 + SHIFT) |
||
137 | #define SF3 (0x12 + SHIFT) |
||
138 | #define SF4 (0x13 + SHIFT) |
||
139 | #define SF5 (0x14 + SHIFT) |
||
140 | #define SF6 (0x15 + SHIFT) |
||
141 | #define SF7 (0x16 + SHIFT) |
||
142 | #define SF8 (0x17 + SHIFT) |
||
143 | #define SF9 (0x18 + SHIFT) |
||
144 | #define SF10 (0x19 + SHIFT) |
||
145 | #define SF11 (0x1A + SHIFT) |
||
146 | #define SF12 (0x1B + SHIFT) |
||
147 | |||
148 | /* Alt+Shift+Fn */
|
||
149 | #define ASF1 (0x10 + ALT + SHIFT) |
||
150 | #define ASF2 (0x11 + ALT + SHIFT) |
||
151 | #define ASF3 (0x12 + ALT + SHIFT) |
||
152 | #define ASF4 (0x13 + ALT + SHIFT) |
||
153 | #define ASF5 (0x14 + ALT + SHIFT) |
||
154 | #define ASF6 (0x15 + ALT + SHIFT) |
||
155 | #define ASF7 (0x16 + ALT + SHIFT) |
||
156 | #define ASF8 (0x17 + ALT + SHIFT) |
||
157 | #define ASF9 (0x18 + ALT + SHIFT) |
||
158 | #define ASF10 (0x19 + ALT + SHIFT) |
||
159 | #define ASF11 (0x1A + ALT + SHIFT) |
||
160 | #define ASF12 (0x1B + ALT + SHIFT) |
||
161 | |||
162 | #define MAP_COLS 6 /* Number of columns in keymap */ |
||
163 | #define NR_SCAN_CODES 0xE8 /* Number of scan codes (rows in keymap) */ |
||
164 | |||
165 | typedef uint16_t keymap_t[NR_SCAN_CODES][MAP_COLS];
|
||
166 | |||
167 | #define KEY_MAGIC "KMAZ" /* Magic number of keymap file */ |
||
168 | |||
169 | #endif /* _SYS__KEYMAP_H */ |