7
|
1 /* vi:set ts=8 sts=4 sw=4:
|
|
2 *
|
|
3 * VIM - Vi IMproved by Bram Moolenaar
|
|
4 *
|
|
5 * Do ":help uganda" in Vim to read copying and usage conditions.
|
|
6 * Do ":help credits" in Vim to see a list of people who contributed.
|
|
7 */
|
|
8
|
|
9 /*
|
|
10 * For MSDOS some keys produce codes larger than 0xff. They are split into two
|
|
11 * chars, the first one is K_NUL (same value used in term.h).
|
|
12 */
|
|
13 #define K_NUL (0xce) /* for MSDOS: special key follows */
|
|
14
|
|
15 /*
|
|
16 * Keycode definitions for special keys.
|
|
17 *
|
|
18 * Any special key code sequences are replaced by these codes.
|
|
19 */
|
|
20
|
|
21 /*
|
|
22 * K_SPECIAL is the first byte of a special key code and is always followed by
|
|
23 * two bytes.
|
|
24 * The second byte can have any value. ASCII is used for normal termcap
|
|
25 * entries, 0x80 and higher for special keys, see below.
|
|
26 * The third byte is guaranteed to be between 0x02 and 0x7f.
|
|
27 */
|
|
28
|
|
29 #define K_SPECIAL (0x80)
|
|
30
|
|
31 /*
|
|
32 * Positive characters are "normal" characters.
|
|
33 * Negative characters are special key codes. Only characters below -0x200
|
|
34 * are used to so that the absolute value can't be mistaken for a single-byte
|
|
35 * character.
|
|
36 */
|
|
37 #define IS_SPECIAL(c) ((c) < 0)
|
|
38
|
|
39 /*
|
|
40 * Characters 0x0100 - 0x01ff have a special meaning for abbreviations.
|
|
41 * Multi-byte characters also have ABBR_OFF added, thus are above 0x0200.
|
|
42 */
|
|
43 #define ABBR_OFF 0x100
|
|
44
|
|
45 /*
|
|
46 * NUL cannot be in the input string, therefore it is replaced by
|
|
47 * K_SPECIAL KS_ZERO KE_FILLER
|
|
48 */
|
|
49 #define KS_ZERO 255
|
|
50
|
|
51 /*
|
|
52 * K_SPECIAL cannot be in the input string, therefore it is replaced by
|
|
53 * K_SPECIAL KS_SPECIAL KE_FILLER
|
|
54 */
|
|
55 #define KS_SPECIAL 254
|
|
56
|
|
57 /*
|
|
58 * KS_EXTRA is used for keys that have no termcap name
|
|
59 * K_SPECIAL KS_EXTRA KE_xxx
|
|
60 */
|
|
61 #define KS_EXTRA 253
|
|
62
|
|
63 /*
|
|
64 * KS_MODIFIER is used when a modifier is given for a (special) key
|
|
65 * K_SPECIAL KS_MODIFIER bitmask
|
|
66 */
|
|
67 #define KS_MODIFIER 252
|
|
68
|
|
69 /*
|
|
70 * These are used for the GUI
|
|
71 * K_SPECIAL KS_xxx KE_FILLER
|
|
72 */
|
|
73 #define KS_MOUSE 251
|
|
74 #define KS_MENU 250
|
|
75 #define KS_VER_SCROLLBAR 249
|
|
76 #define KS_HOR_SCROLLBAR 248
|
|
77
|
|
78 /*
|
|
79 * These are used for DEC mouse
|
|
80 */
|
|
81 #define KS_NETTERM_MOUSE 247
|
|
82 #define KS_DEC_MOUSE 246
|
|
83
|
|
84 /*
|
|
85 * Used for switching Select mode back on after a mapping or menu.
|
|
86 */
|
|
87 #define KS_SELECT 245
|
|
88 #define K_SELECT_STRING (char_u *)"\200\365X"
|
|
89
|
|
90 /*
|
|
91 * Used for tearing off a menu.
|
|
92 */
|
|
93 #define KS_TEAROFF 244
|
|
94
|
|
95 /* used for JSB term mouse */
|
|
96 #define KS_JSBTERM_MOUSE 243
|
|
97
|
|
98 /* used a termcap entry that produces a normal character */
|
|
99 #define KS_KEY 242
|
|
100
|
|
101 /* Used for the qnx pterm mouse */
|
|
102 #define KS_PTERM_MOUSE 241
|
|
103
|
|
104 /*
|
|
105 * Filler used after KS_SPECIAL and others
|
|
106 */
|
|
107 #define KE_FILLER ('X')
|
|
108
|
|
109 /*
|
|
110 * translation of three byte code "K_SPECIAL a b" into int "K_xxx" and back
|
|
111 */
|
|
112 #define TERMCAP2KEY(a, b) (-((a) + ((int)(b) << 8)))
|
|
113 #define KEY2TERMCAP0(x) ((-(x)) & 0xff)
|
|
114 #define KEY2TERMCAP1(x) (((unsigned)(-(x)) >> 8) & 0xff)
|
|
115
|
|
116 /*
|
|
117 * get second or third byte when translating special key code into three bytes
|
|
118 */
|
|
119 #define K_SECOND(c) ((c) == K_SPECIAL ? KS_SPECIAL : (c) == NUL ? KS_ZERO : KEY2TERMCAP0(c))
|
|
120
|
|
121 #define K_THIRD(c) (((c) == K_SPECIAL || (c) == NUL) ? KE_FILLER : KEY2TERMCAP1(c))
|
|
122
|
|
123 /*
|
|
124 * get single int code from second byte after K_SPECIAL
|
|
125 */
|
|
126 #define TO_SPECIAL(a, b) ((a) == KS_SPECIAL ? K_SPECIAL : (a) == KS_ZERO ? K_ZERO : TERMCAP2KEY(a, b))
|
|
127
|
|
128 /*
|
|
129 * Codes for keys that do not have a termcap name.
|
|
130 *
|
|
131 * K_SPECIAL KS_EXTRA KE_xxx
|
|
132 */
|
|
133 enum key_extra
|
|
134 {
|
|
135 KE_NAME = 3 /* name of this terminal entry */
|
|
136
|
|
137 , KE_S_UP /* shift-up */
|
|
138 , KE_S_DOWN /* shift-down */
|
|
139
|
|
140 , KE_S_F1 /* shifted function keys */
|
|
141 , KE_S_F2
|
|
142 , KE_S_F3
|
|
143 , KE_S_F4
|
|
144 , KE_S_F5
|
|
145 , KE_S_F6
|
|
146 , KE_S_F7
|
|
147 , KE_S_F8
|
|
148 , KE_S_F9
|
|
149 , KE_S_F10
|
|
150
|
|
151 , KE_S_F11
|
|
152 , KE_S_F12
|
|
153 , KE_S_F13
|
|
154 , KE_S_F14
|
|
155 , KE_S_F15
|
|
156 , KE_S_F16
|
|
157 , KE_S_F17
|
|
158 , KE_S_F18
|
|
159 , KE_S_F19
|
|
160 , KE_S_F20
|
|
161
|
|
162 , KE_S_F21
|
|
163 , KE_S_F22
|
|
164 , KE_S_F23
|
|
165 , KE_S_F24
|
|
166 , KE_S_F25
|
|
167 , KE_S_F26
|
|
168 , KE_S_F27
|
|
169 , KE_S_F28
|
|
170 , KE_S_F29
|
|
171 , KE_S_F30
|
|
172
|
|
173 , KE_S_F31
|
|
174 , KE_S_F32
|
|
175 , KE_S_F33
|
|
176 , KE_S_F34
|
|
177 , KE_S_F35
|
|
178 , KE_S_F36
|
|
179 , KE_S_F37
|
|
180
|
|
181 , KE_MOUSE /* mouse event start */
|
|
182
|
|
183 /*
|
|
184 * Symbols for pseudo keys which are translated from the real key symbols
|
|
185 * above.
|
|
186 */
|
|
187 , KE_LEFTMOUSE /* Left mouse button click */
|
|
188 , KE_LEFTDRAG /* Drag with left mouse button down */
|
|
189 , KE_LEFTRELEASE /* Left mouse button release */
|
|
190 , KE_MIDDLEMOUSE /* Middle mouse button click */
|
|
191 , KE_MIDDLEDRAG /* Drag with middle mouse button down */
|
|
192 , KE_MIDDLERELEASE /* Middle mouse button release */
|
|
193 , KE_RIGHTMOUSE /* Right mouse button click */
|
|
194 , KE_RIGHTDRAG /* Drag with right mouse button down */
|
|
195 , KE_RIGHTRELEASE /* Right mouse button release */
|
|
196
|
|
197 , KE_IGNORE /* Ignored mouse drag/release */
|
|
198
|
|
199 , KE_TAB /* unshifted TAB key */
|
|
200 , KE_S_TAB_OLD /* shifted TAB key (no longer used) */
|
|
201
|
|
202 , KE_SNIFF /* SNiFF+ input waiting */
|
|
203
|
|
204 , KE_XF1 /* extra vt100 function keys for xterm */
|
|
205 , KE_XF2
|
|
206 , KE_XF3
|
|
207 , KE_XF4
|
|
208 , KE_XEND /* extra (vt100) end key for xterm */
|
230
|
209 , KE_ZEND /* extra (vt100) end key for xterm */
|
7
|
210 , KE_XHOME /* extra (vt100) home key for xterm */
|
230
|
211 , KE_ZHOME /* extra (vt100) home key for xterm */
|
180
|
212 , KE_XUP /* extra vt100 cursor keys for xterm */
|
|
213 , KE_XDOWN
|
|
214 , KE_XLEFT
|
|
215 , KE_XRIGHT
|
7
|
216
|
|
217 , KE_LEFTMOUSE_NM /* non-mappable Left mouse button click */
|
|
218 , KE_LEFTRELEASE_NM /* non-mappable left mouse button release */
|
|
219
|
|
220 , KE_S_XF1 /* extra vt100 shifted function keys for xterm */
|
|
221 , KE_S_XF2
|
|
222 , KE_S_XF3
|
|
223 , KE_S_XF4
|
|
224
|
|
225 , KE_MOUSEDOWN /* scroll wheel pseudo-button Down */
|
|
226 , KE_MOUSEUP /* scroll wheel pseudo-button Up */
|
|
227
|
|
228 , KE_KINS /* keypad Insert key */
|
|
229 , KE_KDEL /* keypad Delete key */
|
|
230
|
|
231 , KE_CSI /* CSI typed directly */
|
|
232 , KE_SNR /* <SNR> */
|
|
233 , KE_PLUG /* <Plug> */
|
|
234 , KE_CMDWIN /* open command-line window from Command-line Mode */
|
|
235
|
|
236 , KE_C_LEFT /* control-left */
|
|
237 , KE_C_RIGHT /* control-right */
|
|
238 , KE_C_HOME /* control-home */
|
|
239 , KE_C_END /* control-end */
|
|
240
|
|
241 , KE_X1MOUSE /* X1/X2 mouse-buttons */
|
|
242 , KE_X1DRAG
|
|
243 , KE_X1RELEASE
|
|
244 , KE_X2MOUSE
|
|
245 , KE_X2DRAG
|
|
246 , KE_X2RELEASE
|
|
247
|
|
248 , KE_DROP /* DnD data is available */
|
203
|
249 , KE_CURSORHOLD /* CursorHold event */
|
7
|
250 };
|
|
251
|
|
252 /*
|
|
253 * the three byte codes are replaced with the following int when using vgetc()
|
|
254 */
|
|
255 #define K_ZERO TERMCAP2KEY(KS_ZERO, KE_FILLER)
|
|
256
|
|
257 #define K_UP TERMCAP2KEY('k', 'u')
|
|
258 #define K_DOWN TERMCAP2KEY('k', 'd')
|
|
259 #define K_LEFT TERMCAP2KEY('k', 'l')
|
|
260 #define K_RIGHT TERMCAP2KEY('k', 'r')
|
|
261 #define K_S_UP TERMCAP2KEY(KS_EXTRA, KE_S_UP)
|
|
262 #define K_S_DOWN TERMCAP2KEY(KS_EXTRA, KE_S_DOWN)
|
|
263 #define K_S_LEFT TERMCAP2KEY('#', '4')
|
|
264 #define K_C_LEFT TERMCAP2KEY(KS_EXTRA, KE_C_LEFT)
|
|
265 #define K_S_RIGHT TERMCAP2KEY('%', 'i')
|
|
266 #define K_C_RIGHT TERMCAP2KEY(KS_EXTRA, KE_C_RIGHT)
|
|
267 #define K_S_HOME TERMCAP2KEY('#', '2')
|
|
268 #define K_C_HOME TERMCAP2KEY(KS_EXTRA, KE_C_HOME)
|
|
269 #define K_S_END TERMCAP2KEY('*', '7')
|
|
270 #define K_C_END TERMCAP2KEY(KS_EXTRA, KE_C_END)
|
|
271 #define K_TAB TERMCAP2KEY(KS_EXTRA, KE_TAB)
|
|
272 #define K_S_TAB TERMCAP2KEY('k', 'B')
|
|
273
|
|
274 /* extra set of function keys F1-F4, for vt100 compatible xterm */
|
|
275 #define K_XF1 TERMCAP2KEY(KS_EXTRA, KE_XF1)
|
|
276 #define K_XF2 TERMCAP2KEY(KS_EXTRA, KE_XF2)
|
|
277 #define K_XF3 TERMCAP2KEY(KS_EXTRA, KE_XF3)
|
|
278 #define K_XF4 TERMCAP2KEY(KS_EXTRA, KE_XF4)
|
|
279
|
180
|
280 /* extra set of cursor keys for vt100 compatible xterm */
|
|
281 #define K_XUP TERMCAP2KEY(KS_EXTRA, KE_XUP)
|
|
282 #define K_XDOWN TERMCAP2KEY(KS_EXTRA, KE_XDOWN)
|
|
283 #define K_XLEFT TERMCAP2KEY(KS_EXTRA, KE_XLEFT)
|
|
284 #define K_XRIGHT TERMCAP2KEY(KS_EXTRA, KE_XRIGHT)
|
|
285
|
7
|
286 #define K_F1 TERMCAP2KEY('k', '1') /* function keys */
|
|
287 #define K_F2 TERMCAP2KEY('k', '2')
|
|
288 #define K_F3 TERMCAP2KEY('k', '3')
|
|
289 #define K_F4 TERMCAP2KEY('k', '4')
|
|
290 #define K_F5 TERMCAP2KEY('k', '5')
|
|
291 #define K_F6 TERMCAP2KEY('k', '6')
|
|
292 #define K_F7 TERMCAP2KEY('k', '7')
|
|
293 #define K_F8 TERMCAP2KEY('k', '8')
|
|
294 #define K_F9 TERMCAP2KEY('k', '9')
|
|
295 #define K_F10 TERMCAP2KEY('k', ';')
|
|
296
|
|
297 #define K_F11 TERMCAP2KEY('F', '1')
|
|
298 #define K_F12 TERMCAP2KEY('F', '2')
|
|
299 #define K_F13 TERMCAP2KEY('F', '3')
|
|
300 #define K_F14 TERMCAP2KEY('F', '4')
|
|
301 #define K_F15 TERMCAP2KEY('F', '5')
|
|
302 #define K_F16 TERMCAP2KEY('F', '6')
|
|
303 #define K_F17 TERMCAP2KEY('F', '7')
|
|
304 #define K_F18 TERMCAP2KEY('F', '8')
|
|
305 #define K_F19 TERMCAP2KEY('F', '9')
|
|
306 #define K_F20 TERMCAP2KEY('F', 'A')
|
|
307
|
|
308 #define K_F21 TERMCAP2KEY('F', 'B')
|
|
309 #define K_F22 TERMCAP2KEY('F', 'C')
|
|
310 #define K_F23 TERMCAP2KEY('F', 'D')
|
|
311 #define K_F24 TERMCAP2KEY('F', 'E')
|
|
312 #define K_F25 TERMCAP2KEY('F', 'F')
|
|
313 #define K_F26 TERMCAP2KEY('F', 'G')
|
|
314 #define K_F27 TERMCAP2KEY('F', 'H')
|
|
315 #define K_F28 TERMCAP2KEY('F', 'I')
|
|
316 #define K_F29 TERMCAP2KEY('F', 'J')
|
|
317 #define K_F30 TERMCAP2KEY('F', 'K')
|
|
318
|
|
319 #define K_F31 TERMCAP2KEY('F', 'L')
|
|
320 #define K_F32 TERMCAP2KEY('F', 'M')
|
|
321 #define K_F33 TERMCAP2KEY('F', 'N')
|
|
322 #define K_F34 TERMCAP2KEY('F', 'O')
|
|
323 #define K_F35 TERMCAP2KEY('F', 'P')
|
|
324 #define K_F36 TERMCAP2KEY('F', 'Q')
|
|
325 #define K_F37 TERMCAP2KEY('F', 'R')
|
|
326
|
|
327 /* extra set of shifted function keys F1-F4, for vt100 compatible xterm */
|
|
328 #define K_S_XF1 TERMCAP2KEY(KS_EXTRA, KE_S_XF1)
|
|
329 #define K_S_XF2 TERMCAP2KEY(KS_EXTRA, KE_S_XF2)
|
|
330 #define K_S_XF3 TERMCAP2KEY(KS_EXTRA, KE_S_XF3)
|
|
331 #define K_S_XF4 TERMCAP2KEY(KS_EXTRA, KE_S_XF4)
|
|
332
|
|
333 #define K_S_F1 TERMCAP2KEY(KS_EXTRA, KE_S_F1) /* shifted func. keys */
|
|
334 #define K_S_F2 TERMCAP2KEY(KS_EXTRA, KE_S_F2)
|
|
335 #define K_S_F3 TERMCAP2KEY(KS_EXTRA, KE_S_F3)
|
|
336 #define K_S_F4 TERMCAP2KEY(KS_EXTRA, KE_S_F4)
|
|
337 #define K_S_F5 TERMCAP2KEY(KS_EXTRA, KE_S_F5)
|
|
338 #define K_S_F6 TERMCAP2KEY(KS_EXTRA, KE_S_F6)
|
|
339 #define K_S_F7 TERMCAP2KEY(KS_EXTRA, KE_S_F7)
|
|
340 #define K_S_F8 TERMCAP2KEY(KS_EXTRA, KE_S_F8)
|
|
341 #define K_S_F9 TERMCAP2KEY(KS_EXTRA, KE_S_F9)
|
|
342 #define K_S_F10 TERMCAP2KEY(KS_EXTRA, KE_S_F10)
|
|
343
|
|
344 #define K_S_F11 TERMCAP2KEY(KS_EXTRA, KE_S_F11)
|
|
345 #define K_S_F12 TERMCAP2KEY(KS_EXTRA, KE_S_F12)
|
|
346 #define K_S_F13 TERMCAP2KEY(KS_EXTRA, KE_S_F13)
|
|
347 #define K_S_F14 TERMCAP2KEY(KS_EXTRA, KE_S_F14)
|
|
348 #define K_S_F15 TERMCAP2KEY(KS_EXTRA, KE_S_F15)
|
|
349 #define K_S_F16 TERMCAP2KEY(KS_EXTRA, KE_S_F16)
|
|
350 #define K_S_F17 TERMCAP2KEY(KS_EXTRA, KE_S_F17)
|
|
351 #define K_S_F18 TERMCAP2KEY(KS_EXTRA, KE_S_F18)
|
|
352 #define K_S_F19 TERMCAP2KEY(KS_EXTRA, KE_S_F19)
|
|
353 #define K_S_F20 TERMCAP2KEY(KS_EXTRA, KE_S_F20)
|
|
354
|
|
355 #define K_S_F21 TERMCAP2KEY(KS_EXTRA, KE_S_F21)
|
|
356 #define K_S_F22 TERMCAP2KEY(KS_EXTRA, KE_S_F22)
|
|
357 #define K_S_F23 TERMCAP2KEY(KS_EXTRA, KE_S_F23)
|
|
358 #define K_S_F24 TERMCAP2KEY(KS_EXTRA, KE_S_F24)
|
|
359 #define K_S_F25 TERMCAP2KEY(KS_EXTRA, KE_S_F25)
|
|
360 #define K_S_F26 TERMCAP2KEY(KS_EXTRA, KE_S_F26)
|
|
361 #define K_S_F27 TERMCAP2KEY(KS_EXTRA, KE_S_F27)
|
|
362 #define K_S_F28 TERMCAP2KEY(KS_EXTRA, KE_S_F28)
|
|
363 #define K_S_F29 TERMCAP2KEY(KS_EXTRA, KE_S_F29)
|
|
364 #define K_S_F30 TERMCAP2KEY(KS_EXTRA, KE_S_F30)
|
|
365
|
|
366 #define K_S_F31 TERMCAP2KEY(KS_EXTRA, KE_S_F31)
|
|
367 #define K_S_F32 TERMCAP2KEY(KS_EXTRA, KE_S_F32)
|
|
368 #define K_S_F33 TERMCAP2KEY(KS_EXTRA, KE_S_F33)
|
|
369 #define K_S_F34 TERMCAP2KEY(KS_EXTRA, KE_S_F34)
|
|
370 #define K_S_F35 TERMCAP2KEY(KS_EXTRA, KE_S_F35)
|
|
371 #define K_S_F36 TERMCAP2KEY(KS_EXTRA, KE_S_F36)
|
|
372 #define K_S_F37 TERMCAP2KEY(KS_EXTRA, KE_S_F37)
|
|
373
|
|
374 #define K_HELP TERMCAP2KEY('%', '1')
|
|
375 #define K_UNDO TERMCAP2KEY('&', '8')
|
|
376
|
|
377 #define K_BS TERMCAP2KEY('k', 'b')
|
|
378
|
|
379 #define K_INS TERMCAP2KEY('k', 'I')
|
|
380 #define K_KINS TERMCAP2KEY(KS_EXTRA, KE_KINS)
|
|
381 #define K_DEL TERMCAP2KEY('k', 'D')
|
|
382 #define K_KDEL TERMCAP2KEY(KS_EXTRA, KE_KDEL)
|
|
383 #define K_HOME TERMCAP2KEY('k', 'h')
|
|
384 #define K_KHOME TERMCAP2KEY('K', '1') /* keypad home (upper left) */
|
|
385 #define K_XHOME TERMCAP2KEY(KS_EXTRA, KE_XHOME)
|
230
|
386 #define K_ZHOME TERMCAP2KEY(KS_EXTRA, KE_ZHOME)
|
7
|
387 #define K_END TERMCAP2KEY('@', '7')
|
|
388 #define K_KEND TERMCAP2KEY('K', '4') /* keypad end (lower left) */
|
|
389 #define K_XEND TERMCAP2KEY(KS_EXTRA, KE_XEND)
|
230
|
390 #define K_ZEND TERMCAP2KEY(KS_EXTRA, KE_ZEND)
|
7
|
391 #define K_PAGEUP TERMCAP2KEY('k', 'P')
|
|
392 #define K_PAGEDOWN TERMCAP2KEY('k', 'N')
|
|
393 #define K_KPAGEUP TERMCAP2KEY('K', '3') /* keypad pageup (upper R.) */
|
|
394 #define K_KPAGEDOWN TERMCAP2KEY('K', '5') /* keypad pagedown (lower R.) */
|
|
395
|
|
396 #define K_KPLUS TERMCAP2KEY('K', '6') /* keypad plus */
|
|
397 #define K_KMINUS TERMCAP2KEY('K', '7') /* keypad minus */
|
|
398 #define K_KDIVIDE TERMCAP2KEY('K', '8') /* keypad / */
|
|
399 #define K_KMULTIPLY TERMCAP2KEY('K', '9') /* keypad * */
|
|
400 #define K_KENTER TERMCAP2KEY('K', 'A') /* keypad Enter */
|
36
|
401 #define K_KPOINT TERMCAP2KEY('K', 'B') /* keypad . or ,*/
|
7
|
402
|
|
403 #define K_K0 TERMCAP2KEY('K', 'C') /* keypad 0 */
|
|
404 #define K_K1 TERMCAP2KEY('K', 'D') /* keypad 1 */
|
|
405 #define K_K2 TERMCAP2KEY('K', 'E') /* keypad 2 */
|
|
406 #define K_K3 TERMCAP2KEY('K', 'F') /* keypad 3 */
|
|
407 #define K_K4 TERMCAP2KEY('K', 'G') /* keypad 4 */
|
|
408 #define K_K5 TERMCAP2KEY('K', 'H') /* keypad 5 */
|
|
409 #define K_K6 TERMCAP2KEY('K', 'I') /* keypad 6 */
|
|
410 #define K_K7 TERMCAP2KEY('K', 'J') /* keypad 7 */
|
|
411 #define K_K8 TERMCAP2KEY('K', 'K') /* keypad 8 */
|
|
412 #define K_K9 TERMCAP2KEY('K', 'L') /* keypad 9 */
|
|
413
|
|
414 #define K_MOUSE TERMCAP2KEY(KS_MOUSE, KE_FILLER)
|
|
415 #define K_MENU TERMCAP2KEY(KS_MENU, KE_FILLER)
|
|
416 #define K_VER_SCROLLBAR TERMCAP2KEY(KS_VER_SCROLLBAR, KE_FILLER)
|
|
417 #define K_HOR_SCROLLBAR TERMCAP2KEY(KS_HOR_SCROLLBAR, KE_FILLER)
|
|
418
|
|
419 #define K_NETTERM_MOUSE TERMCAP2KEY(KS_NETTERM_MOUSE, KE_FILLER)
|
|
420 #define K_DEC_MOUSE TERMCAP2KEY(KS_DEC_MOUSE, KE_FILLER)
|
|
421 #define K_JSBTERM_MOUSE TERMCAP2KEY(KS_JSBTERM_MOUSE, KE_FILLER)
|
|
422 #define K_PTERM_MOUSE TERMCAP2KEY(KS_PTERM_MOUSE, KE_FILLER)
|
|
423
|
|
424 #define K_SELECT TERMCAP2KEY(KS_SELECT, KE_FILLER)
|
|
425 #define K_TEAROFF TERMCAP2KEY(KS_TEAROFF, KE_FILLER)
|
|
426
|
|
427 /*
|
|
428 * Symbols for pseudo keys which are translated from the real key symbols
|
|
429 * above.
|
|
430 */
|
|
431 #define K_LEFTMOUSE TERMCAP2KEY(KS_EXTRA, KE_LEFTMOUSE)
|
|
432 #define K_LEFTMOUSE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTMOUSE_NM)
|
|
433 #define K_LEFTDRAG TERMCAP2KEY(KS_EXTRA, KE_LEFTDRAG)
|
|
434 #define K_LEFTRELEASE TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE)
|
|
435 #define K_LEFTRELEASE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE_NM)
|
|
436 #define K_MIDDLEMOUSE TERMCAP2KEY(KS_EXTRA, KE_MIDDLEMOUSE)
|
|
437 #define K_MIDDLEDRAG TERMCAP2KEY(KS_EXTRA, KE_MIDDLEDRAG)
|
|
438 #define K_MIDDLERELEASE TERMCAP2KEY(KS_EXTRA, KE_MIDDLERELEASE)
|
|
439 #define K_RIGHTMOUSE TERMCAP2KEY(KS_EXTRA, KE_RIGHTMOUSE)
|
|
440 #define K_RIGHTDRAG TERMCAP2KEY(KS_EXTRA, KE_RIGHTDRAG)
|
|
441 #define K_RIGHTRELEASE TERMCAP2KEY(KS_EXTRA, KE_RIGHTRELEASE)
|
|
442 #define K_X1MOUSE TERMCAP2KEY(KS_EXTRA, KE_X1MOUSE)
|
|
443 #define K_X1MOUSE TERMCAP2KEY(KS_EXTRA, KE_X1MOUSE)
|
|
444 #define K_X1DRAG TERMCAP2KEY(KS_EXTRA, KE_X1DRAG)
|
|
445 #define K_X1RELEASE TERMCAP2KEY(KS_EXTRA, KE_X1RELEASE)
|
|
446 #define K_X2MOUSE TERMCAP2KEY(KS_EXTRA, KE_X2MOUSE)
|
|
447 #define K_X2DRAG TERMCAP2KEY(KS_EXTRA, KE_X2DRAG)
|
|
448 #define K_X2RELEASE TERMCAP2KEY(KS_EXTRA, KE_X2RELEASE)
|
|
449
|
|
450 #define K_IGNORE TERMCAP2KEY(KS_EXTRA, KE_IGNORE)
|
|
451
|
|
452 #define K_SNIFF TERMCAP2KEY(KS_EXTRA, KE_SNIFF)
|
|
453
|
|
454 #define K_MOUSEDOWN TERMCAP2KEY(KS_EXTRA, KE_MOUSEDOWN)
|
|
455 #define K_MOUSEUP TERMCAP2KEY(KS_EXTRA, KE_MOUSEUP)
|
|
456
|
|
457 #define K_CSI TERMCAP2KEY(KS_EXTRA, KE_CSI)
|
|
458 #define K_SNR TERMCAP2KEY(KS_EXTRA, KE_SNR)
|
|
459 #define K_PLUG TERMCAP2KEY(KS_EXTRA, KE_PLUG)
|
|
460 #define K_CMDWIN TERMCAP2KEY(KS_EXTRA, KE_CMDWIN)
|
|
461
|
|
462 #define K_DROP TERMCAP2KEY(KS_EXTRA, KE_DROP)
|
|
463
|
203
|
464 #define K_CURSORHOLD TERMCAP2KEY(KS_EXTRA, KE_CURSORHOLD)
|
|
465
|
7
|
466 /* Bits for modifier mask */
|
|
467 /* 0x01 cannot be used, because the modifier must be 0x02 or higher */
|
|
468 #define MOD_MASK_SHIFT 0x02
|
|
469 #define MOD_MASK_CTRL 0x04
|
|
470 #define MOD_MASK_ALT 0x08 /* aka META */
|
179
|
471 #define MOD_MASK_META 0x10 /* META when it's different from ALT */
|
|
472 #define MOD_MASK_2CLICK 0x20 /* use MOD_MASK_MULTI_CLICK */
|
|
473 #define MOD_MASK_3CLICK 0x40 /* use MOD_MASK_MULTI_CLICK */
|
|
474 #define MOD_MASK_4CLICK 0x60 /* use MOD_MASK_MULTI_CLICK */
|
7
|
475 #ifdef MACOS
|
179
|
476 # define MOD_MASK_CMD 0x80
|
7
|
477 #endif
|
|
478
|
|
479 #define MOD_MASK_MULTI_CLICK (MOD_MASK_2CLICK|MOD_MASK_3CLICK|MOD_MASK_4CLICK)
|
|
480
|
|
481 /*
|
|
482 * The length of the longest special key name, including modifiers.
|
179
|
483 * Current longest is <M-C-S-T-4-MiddleRelease> (length includes '<' and '>').
|
7
|
484 */
|
179
|
485 #define MAX_KEY_NAME_LEN 25
|
7
|
486
|
|
487 /* Maximum length of a special key event as tokens. This includes modifiers.
|
179
|
488 * The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
|
7
|
489 * following string of tokens:
|
|
490 *
|
|
491 * <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KT_LEFTDRAG>.
|
|
492 *
|
|
493 * This is a total of 6 tokens, and is currently the longest one possible.
|
|
494 */
|
|
495 #define MAX_KEY_CODE_LEN 6
|