-
Notifications
You must be signed in to change notification settings - Fork 1
/
keymap.go
521 lines (518 loc) · 8.21 KB
/
keymap.go
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
package main
// rough attempt at mapping the vnc (x11) keycodes to usb scancodes
// for an en_us keyboard layout
var x11ToUsb1 = [...]int{
-1, //0
-1, //0x1
-1, //0x2
-1, //0x3
-1, //0x4
-1, //0x5
-1, //0x6
-1, //0x7
-1, //0x8
-1, //0x9
-1, //0xa
-1, //0xb
-1, //0xc
-1, //0xd
-1, //0xe
-1, //0xf
-1, //0x10
-1, //0x11
-1, //0x12
-1, //0x13
-1, //0x14
-1, //0x15
-1, //0x16
-1, //0x17
-1, //0x18
-1, //0x19
-1, //0x1a
-1, //0x1b
-1, //0x1c
-1, //0x1d
-1, //0x1e
-1, //0x1f
0x2c, //0x20 space
0x1e, //0x21 exclam
0x34, //0x22 quotedbl
0x20, //0x23 numbersign
0x21, //0x24 dollar
0x22, //0x25 percent
0x24, //0x26 ampersand
0x34, //0x27 quoteright
0x26, //0x28 parenleft
0x27, //0x29 parenright
0x25, //0x2a asterisk
0x2e, //0x2b plus
0x36, //0x2c comma
0x2d, //0x2d minus
0x37, //0x2e period
0x38, //0x2f slash
0x27, //0x30 0
0x1e, //0x31 1
0x1f, //0x32 2
0x20, //0x33 3
0x21, //0x34 4
0x22, //0x35 5
0x23, //0x36 6
0x24, //0x37 7
0x25, //0x38 8
0x26, //0x39 9
0x33, //0x3a colon
0x33, //0x3b semicolon
0x36, //0x3c less
0x2e, //0x3d equal
0x37, //0x3e greater
0x38, //0x3f question
0x1f, //0x40 at
0x4, //0x41 A
0x5, //0x42 B
0x6, //0x43 C
0x7, //0x44 D
0x8, //0x45 E
0x9, //0x46 F
0xa, //0x47 G
0xb, //0x48 H
0xc, //0x49 I
0xd, //0x4a J
0xe, //0x4b K
0xf, //0x4c L
0x10, //0x4d M
0x11, //0x4e N
0x12, //0x4f O
0x13, //0x50 P
0x14, //0x51 Q
0x15, //0x52 R
0x16, //0x53 S
0x17, //0x54 T
0x18, //0x55 U
0x19, //0x56 V
0x1a, //0x57 W
0x1b, //0x58 X
0x1c, //0x59 Y
0x1d, //0x5a Z
0x2f, //0x5b bracketleft
0x31, //0x5c backslash
0x30, //0x5d bracketright
-1, //0x5e asciicircum
0x2d, //0x5f underscore
0x35, //0x60 quoteleft
0x4, //0x61 a
0x5, //0x62 b
0x6, //0x63 c
0x7, //0x64 d
0x8, //0x65 e
0x9, //0x66 f
0xa, //0x67 g
0xb, //0x68 h
0xc, //0x69 i
0xd, //0x6a j
0xe, //0x6b k
0xf, //0x6c l
0x10, //0x6d m
0x11, //0x6e n
0x12, //0x6f o
0x13, //0x70 p
0x14, //0x71 q
0x15, //0x72 r
0x16, //0x73 s
0x17, //0x74 t
0x18, //0x75 u
0x19, //0x76 v
0x1a, //0x77 w
0x1b, //0x78 x
0x1c, //0x79 y
0x1d, //0x7a z
0x2f, //0x7b braceleft
0x31, //0x7c bar
0x30, //0x7d braceright
0x35, //0x7e asciitilde
-1, //0x7f
-1, //0x80
-1, //0x81
-1, //0x82
-1, //0x83
-1, //0x84
-1, //0x85
-1, //0x86
-1, //0x87
-1, //0x88
-1, //0x89
-1, //0x8a
-1, //0x8b
-1, //0x8c
-1, //0x8d
-1, //0x8e
-1, //0x8f
-1, //0x90
-1, //0x91
-1, //0x92
-1, //0x93
-1, //0x94
-1, //0x95
-1, //0x96
-1, //0x97
-1, //0x98
-1, //0x99
-1, //0x9a
-1, //0x9b
-1, //0x9c
-1, //0x9d
-1, //0x9e
-1, //0x9f
-1, //0xa0
-1, //0xa1
-1, //0xa2
-1, //0xa3
-1, //0xa4
-1, //0xa5
-1, //0xa6
-1, //0xa7
-1, //0xa8
-1, //0xa9
-1, //0xaa
-1, //0xab
-1, //0xac
-1, //0xad
-1, //0xae
-1, //0xaf
-1, //0xb0
-1, //0xb1
-1, //0xb2
-1, //0xb3
-1, //0xb4
-1, //0xb5
-1, //0xb6
-1, //0xb7
-1, //0xb8
-1, //0xb9
-1, //0xba
-1, //0xbb
-1, //0xbc
-1, //0xbd
-1, //0xbe
-1, //0xbf
-1, //0xc0
-1, //0xc1
-1, //0xc2
-1, //0xc3
-1, //0xc4
-1, //0xc5
-1, //0xc6
-1, //0xc7
-1, //0xc8
-1, //0xc9
-1, //0xca
-1, //0xcb
-1, //0xcc
-1, //0xcd
-1, //0xce
-1, //0xcf
-1, //0xd0
-1, //0xd1
-1, //0xd2
-1, //0xd3
-1, //0xd4
-1, //0xd5
-1, //0xd6
-1, //0xd7
-1, //0xd8
-1, //0xd9
-1, //0xda
-1, //0xdb
-1, //0xdc
-1, //0xdd
-1, //0xde
-1, //0xdf
-1, //0xe0
-1, //0xe1
-1, //0xe2
-1, //0xe3
-1, //0xe4
-1, //0xe5
-1, //0xe6
-1, //0xe7
-1, //0xe8
-1, //0xe9
-1, //0xea
-1, //0xeb
-1, //0xec
-1, //0xed
-1, //0xee
-1, //0xef
-1, //0xf0
-1, //0xf1
-1, //0xf2
-1, //0xf3
-1, //0xf4
-1, //0xf5
-1, //0xf6
-1, //0xf7
-1, //0xf8
-1, //0xf9
-1, //0xfa
-1, //0xfb
-1, //0xfc
-1, //0xfd
-1, //0xfe
}
var x11ToUsb2 = [...]int{
-1, //0
-1, //0x1
-1, //0x2
-1, //0x3
-1, //0x4
-1, //0x5
-1, //0x6
-1, //0x7
0x2a, //0x8 backspace
0x2b, //0x9 tab
-1, //0xa linefeed
0x9c, //0xb clear
-1, //0xc
0x28, //0xd return
-1, //0xe
-1, //0xf
-1, //0x10
-1, //0x11
-1, //0x12
0x48, //0x13 pause
0x47, //0x14 scroll_lock
0x46, //0x15 sys_req
-1, //0x16
-1, //0x17
-1, //0x18
-1, //0x19
-1, //0x1a
0x29, //0x1b escape
-1, //0x1c
-1, //0x1d
-1, //0x1e
-1, //0x1f
-1, //0x20
-1, //0x21
-1, //0x22
-1, //0x23
-1, //0x24
-1, //0x25
-1, //0x26
-1, //0x27
-1, //0x28
-1, //0x29
-1, //0x2a
-1, //0x2b
-1, //0x2c
-1, //0x2d
-1, //0x2e
-1, //0x2f
-1, //0x30
-1, //0x31
-1, //0x32
-1, //0x33
-1, //0x34
-1, //0x35
-1, //0x36
-1, //0x37
-1, //0x38
-1, //0x39
-1, //0x3a
-1, //0x3b
-1, //0x3c
-1, //0x3d
-1, //0x3e
-1, //0x3f
-1, //0x40
-1, //0x41
-1, //0x42
-1, //0x43
-1, //0x44
-1, //0x45
-1, //0x46
-1, //0x47
-1, //0x48
-1, //0x49
-1, //0x4a
-1, //0x4b
-1, //0x4c
-1, //0x4d
-1, //0x4e
-1, //0x4f
0x4a, //0x50 home
0x50, //0x51 left
0x52, //0x52 up
0x4f, //0x53 right
0x51, //0x54 down
0x4b, //0x55 page_up
0x4e, //0x56 page_down
0x4d, //0x57 end
-1, //0x58 begin
-1, //0x59
-1, //0x5a
-1, //0x5b
-1, //0x5c
-1, //0x5d
-1, //0x5e
-1, //0x5f
0x77, //0x60 select
-1, //0x61 print
0x74, //0x62 execute
0x49, //0x63 insert
-1, //0x64
0x7a, //0x65 undo
-1, //0x66 redo
0x76, //0x67 menu
0x7e, //0x68 find
0x9b, //0x69 cancel
0x75, //0x6a help
-1, //0x6b break
-1, //0x6c
-1, //0x6d
-1, //0x6e
-1, //0x6f
-1, //0x70
-1, //0x71
-1, //0x72
-1, //0x73
-1, //0x74
-1, //0x75
-1, //0x76
-1, //0x77
-1, //0x78
-1, //0x79
-1, //0x7a
-1, //0x7b
-1, //0x7c
-1, //0x7d
-1, //0x7e script_switch
0x53, //0x7f num_lock
0xcd, //0x80 kp_space
-1, //0x81
-1, //0x82
-1, //0x83
-1, //0x84
-1, //0x85
-1, //0x86
-1, //0x87
-1, //0x88
0xba, //0x89 kp_tab
-1, //0x8a
-1, //0x8b
-1, //0x8c
0x58, //0x8d kp_enter
-1, //0x8e
-1, //0x8f
-1, //0x90
-1, //0x91 kp_f1
-1, //0x92 kp_f2
-1, //0x93 kp_f3
-1, //0x94 kp_f4
-1, //0x95 kp_home
-1, //0x96 kp_left
-1, //0x97 kp_up
-1, //0x98 kp_right
-1, //0x99 kp_down
-1, //0x9a kp_page_up
-1, //0x9b kp_page_down
-1, //0x9c kp_end
-1, //0x9d kp_begin
-1, //0x9e kp_insert
-1, //0x9f kp_delete
-1, //0xa0
-1, //0xa1
-1, //0xa2
-1, //0xa3
-1, //0xa4
-1, //0xa5
-1, //0xa6
-1, //0xa7
-1, //0xa8
-1, //0xa9
0x55, //0xaa kp_multiply
-1, //0xab kp_add
-1, //0xac kp_separator
-1, //0xad kp_subtract
0xdc, //0xae kp_decimal
0x54, //0xaf kp_divide
0x62, //0xb0 kp_0
0x59, //0xb1 kp_1
0x5a, //0xb2 kp_2
0x5b, //0xb3 kp_3
0x5c, //0xb4 kp_4
0x5d, //0xb5 kp_5
0x5e, //0xb6 kp_6
0x5f, //0xb7 kp_7
0x60, //0xb8 kp_8
0x61, //0xb9 kp_9
-1, //0xba
-1, //0xbb
-1, //0xbc
0x67, //0xbd kp_equal
0x3a, //0xbe f1
0x3b, //0xbf f2
0x3c, //0xc0 f3
0x3d, //0xc1 f4
0x3e, //0xc2 f5
0x3f, //0xc3 f6
0x40, //0xc4 f7
0x41, //0xc5 f8
0x42, //0xc6 f9
0x43, //0xc7 f10
-1, //0xc8 l1
-1, //0xc9 l2
-1, //0xca l3
-1, //0xcb l4
-1, //0xcc l5
-1, //0xcd l6
-1, //0xce l7
-1, //0xcf l8
-1, //0xd0 l9
-1, //0xd1 l10
-1, //0xd2 r1
-1, //0xd3 r2
-1, //0xd4 r3
-1, //0xd5 r4
-1, //0xd6 r5
-1, //0xd7 r6
-1, //0xd8 r7
-1, //0xd9 r8
-1, //0xda r9
-1, //0xdb r10
-1, //0xdc r11
-1, //0xdd r12
-1, //0xde r13
-1, //0xdf r14
-1, //0xe0 r15
0xe1, //0xe1 shift_l
0xe5, //0xe2 shift_r
0xe0, //0xe3 control_l
0xe4, //0xe4 control_r
0x39, //0xe5 caps_lock
-1, //0xe6 shift_lock
-1, //0xe7 meta_l
-1, //0xe8 meta_r
0xe2, //0xe9 alt_l
0xe6, //0xea alt_r
-1, //0xeb super_l
-1, //0xec super_r
-1, //0xed hyper_l
-1, //0xee hyper_r
-1, //0xef
-1, //0xf0
-1, //0xf1
-1, //0xf2
-1, //0xf3
-1, //0xf4
-1, //0xf5
-1, //0xf6
-1, //0xf7
-1, //0xf8
-1, //0xf9
-1, //0xfa
-1, //0xfb
-1, //0xfc
-1, //0xfd
-1, //0xfe
0x4c, //0xff delete
}