Major refactor of keymap - now using simple keysym description lists, which can be...
[libguac-client-rdp.git] / src / rdp_keymap_en_us.c
1
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is libguac-client-rdp.
16  *
17  * The Initial Developer of the Original Code is
18  * Michael Jumper.
19  * Portions created by the Initial Developer are Copyright (C) 2011
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  * Matt Hortman
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39 #include <freerdp/input.h>
40
41 #include "rdp_keymap.h"
42
43 static guac_rdp_keysym_desc __guac_rdp_keymap_mapping[] = {
44
45     /* space */
46     { .keysym = 0x0020, .scancode = 0x39 },
47
48     /* exclam */
49     { .keysym = 0x0021, .scancode = 0x02 },
50
51     /* quotedbl */
52     { .keysym = 0x0022, .scancode = 0x28 },
53
54     /* numbersign */
55     { .keysym = 0x0023, .scancode = 0x04 },
56
57     /* dollar */
58     { .keysym = 0x0024, .scancode = 0x05,
59         .set_keysyms = GUAC_KEYSYMS_SHIFT },
60
61     /* percent */
62     { .keysym = 0x0025, .scancode = 0x06 },
63
64     /* ampersand */
65     { .keysym = 0x0026, .scancode = 0x08 },
66
67     /* quoteright */
68     { .keysym = 0x0027, .scancode = 0x28 },
69
70     /* parenleft */
71     { .keysym = 0x0028, .scancode = 0x0A },
72
73     /* parenright */
74     { .keysym = 0x0029, .scancode = 0x0B },
75
76     /* asterisk */
77     { .keysym = 0x002a, .scancode = 0x09 },
78
79     /* plus */
80     { .keysym = 0x002b, .scancode = 0x0D },
81
82     /* comma */
83     { .keysym = 0x002c, .scancode = 0x33 },
84
85     /* minus */
86     { .keysym = 0x002d, .scancode = 0x0C },
87
88     /* period */
89     { .keysym = 0x002e, .scancode = 0x34 },
90
91     /* slash */
92     { .keysym = 0x002f, .scancode = 0x35 },
93
94     /* 0 */
95     { .keysym = 0x0030, .scancode = 0x0B },
96
97     /* 1 */
98     { .keysym = 0x0031, .scancode = 0x02 },
99
100     /* 2 */
101     { .keysym = 0x0032, .scancode = 0x03 },
102
103     /* 3 */
104     { .keysym = 0x0033, .scancode = 0x04 },
105
106     /* 4 */
107     { .keysym = 0x0034, .scancode = 0x05 },
108
109     /* 5 */
110     { .keysym = 0x0035, .scancode = 0x06 },
111
112     /* 6 */
113     { .keysym = 0x0036, .scancode = 0x07 },
114
115     /* 7 */
116     { .keysym = 0x0037, .scancode = 0x08 },
117
118     /* 8 */
119     { .keysym = 0x0038, .scancode = 0x09 },
120
121     /* 9 */
122     { .keysym = 0x0039, .scancode = 0x0A },
123
124     /* colon */
125     { .keysym = 0x003a, .scancode = 0x27 },
126
127     /* semicolon */
128     { .keysym = 0x003b, .scancode = 0x27 },
129
130     /* less */
131     { .keysym = 0x003c, .scancode = 0x33 },
132
133     /* equal */
134     { .keysym = 0x003d, .scancode = 0x0D },
135
136     /* greater */
137     { .keysym = 0x003e, .scancode = 0x34 },
138
139     /* question */
140     { .keysym = 0x003f, .scancode = 0x35 },
141
142     /* at */
143     { .keysym = 0x0040, .scancode = 0x03 },
144
145     /* A */
146     { .keysym = 0x0041, .scancode = 0x1E },
147
148     /* B */
149     { .keysym = 0x0042, .scancode = 0x30 },
150
151     /* C */
152     { .keysym = 0x0043, .scancode = 0x2E },
153
154     /* D */
155     { .keysym = 0x0044, .scancode = 0x20 },
156
157     /* E */
158     { .keysym = 0x0045, .scancode = 0x12 },
159
160     /* F */
161     { .keysym = 0x0046, .scancode = 0x21 },
162
163     /* G */
164     { .keysym = 0x0047, .scancode = 0x22 },
165
166     /* H */
167     { .keysym = 0x0048, .scancode = 0x23 },
168
169     /* I */
170     { .keysym = 0x0049, .scancode = 0x17 },
171
172     /* J */
173     { .keysym = 0x004a, .scancode = 0x24 },
174
175     /* K */
176     { .keysym = 0x004b, .scancode = 0x25 },
177
178     /* L */
179     { .keysym = 0x004c, .scancode = 0x26 },
180
181     /* M */
182     { .keysym = 0x004d, .scancode = 0x32 },
183
184     /* N */
185     { .keysym = 0x004e, .scancode = 0x31 },
186
187     /* O */
188     { .keysym = 0x004f, .scancode = 0x18 },
189
190     /* P */
191     { .keysym = 0x0050, .scancode = 0x19 },
192
193     /* Q */
194     { .keysym = 0x0051, .scancode = 0x10 },
195
196     /* R */
197     { .keysym = 0x0052, .scancode = 0x13 },
198
199     /* S */
200     { .keysym = 0x0053, .scancode = 0x1F },
201
202     /* T */
203     { .keysym = 0x0054, .scancode = 0x14 },
204
205     /* U */
206     { .keysym = 0x0055, .scancode = 0x16 },
207
208     /* V */
209     { .keysym = 0x0056, .scancode = 0x2F },
210
211     /* W */
212     { .keysym = 0x0057, .scancode = 0x11 },
213
214     /* X */
215     { .keysym = 0x0058, .scancode = 0x2D },
216
217     /* Y */
218     { .keysym = 0x0059, .scancode = 0x15 },
219
220     /* Z */
221     { .keysym = 0x005a, .scancode = 0x2C },
222
223     /* bracketleft */
224     { .keysym = 0x005b, .scancode = 0x1A },
225
226     /* backslash */
227     { .keysym = 0x005c, .scancode = 0x2B },
228
229     /* bracketright */
230     { .keysym = 0x005d, .scancode = 0x1B },
231
232     /* asciicircum */
233     { .keysym = 0x005e, .scancode = 0x29 },
234
235     /* underscore */
236     { .keysym = 0x005f, .scancode = 0x0C },
237
238     /* quoteleft */
239     { .keysym = 0x0060, .scancode = 0x29 },
240
241     /* a */
242     { .keysym = 0x0061, .scancode = 0x1E },
243
244     /* b */
245     { .keysym = 0x0062, .scancode = 0x30 },
246
247     /* c */
248     { .keysym = 0x0063, .scancode = 0x2E },
249
250     /* d */
251     { .keysym = 0x0064, .scancode = 0x20 },
252
253     /* e */
254     { .keysym = 0x0065, .scancode = 0x12 },
255
256     /* f */
257     { .keysym = 0x0066, .scancode = 0x21 },
258
259     /* g */
260     { .keysym = 0x0067, .scancode = 0x22 },
261
262     /* h */
263     { .keysym = 0x0068, .scancode = 0x23 },
264
265     /* i */
266     { .keysym = 0x0069, .scancode = 0x17 },
267
268     /* j */
269     { .keysym = 0x006a, .scancode = 0x24 },
270
271     /* k */
272     { .keysym = 0x006b, .scancode = 0x25 },
273
274     /* l */
275     { .keysym = 0x006c, .scancode = 0x26 },
276
277     /* m */
278     { .keysym = 0x006d, .scancode = 0x32 },
279
280     /* n */
281     { .keysym = 0x006e, .scancode = 0x31 },
282
283     /* o */
284     { .keysym = 0x006f, .scancode = 0x18 },
285
286     /* p */
287     { .keysym = 0x0070, .scancode = 0x19 },
288
289     /* q */
290     { .keysym = 0x0071, .scancode = 0x10 },
291
292     /* r */
293     { .keysym = 0x0072, .scancode = 0x13 },
294
295     /* s */
296     { .keysym = 0x0073, .scancode = 0x1F },
297
298     /* t */
299     { .keysym = 0x0074, .scancode = 0x14 },
300
301     /* u */
302     { .keysym = 0x0075, .scancode = 0x16 },
303
304     /* v */
305     { .keysym = 0x0076, .scancode = 0x2F },
306
307     /* w */
308     { .keysym = 0x0077, .scancode = 0x11 },
309
310     /* x */
311     { .keysym = 0x0078, .scancode = 0x2D },
312
313     /* y */
314     { .keysym = 0x0079, .scancode = 0x15 },
315
316     /* z */
317     { .keysym = 0x007a, .scancode = 0x2C },
318
319     /* braceleft */
320     { .keysym = 0x007b, .scancode = 0x1A },
321
322     /* bar */
323     { .keysym = 0x007c, .scancode = 0x2B },
324
325     /* braceright */
326     { .keysym = 0x007d, .scancode = 0x1B },
327
328     /* asciitilde */
329     { .keysym = 0x007e, .scancode = 0x29 },
330
331     /* BackSpace */
332     { .keysym = 0xff08, .scancode = 0x0E },
333
334     /* Tab */
335     { .keysym = 0xff09, .scancode = 0x0F },
336
337     /* Return */
338     { .keysym = 0xff0d, .scancode = 0x1C },
339
340     /* Left */
341     { .keysym = 0xff51, .scancode = 0x4B,
342         .flags = KBD_FLAGS_EXTENDED },
343
344     /* Up */
345     { .keysym = 0xff52, .scancode = 0x48,
346         .flags = KBD_FLAGS_EXTENDED },
347
348     /* Right */
349     { .keysym = 0xff53, .scancode = 0x4D,
350         .flags = KBD_FLAGS_EXTENDED },
351
352     /* Down */
353     { .keysym = 0xff54, .scancode = 0x50,
354         .flags = KBD_FLAGS_EXTENDED },
355
356     /* Menu */
357     { .keysym = 0xff67, .scancode = 0x5D,
358         .flags = KBD_FLAGS_EXTENDED },
359
360     /* KP_0 */
361     { .keysym = 0xffb0, .scancode = 0x52 },
362
363     /* KP_1 */
364     { .keysym = 0xffb1, .scancode = 0x4F },
365
366     /* KP_2 */
367     { .keysym = 0xffb2, .scancode = 0x50 },
368
369     /* KP_3 */
370     { .keysym = 0xffb3, .scancode = 0x51 },
371
372     /* KP_4 */
373     { .keysym = 0xffb4, .scancode = 0x4B },
374
375     /* KP_5 */
376     { .keysym = 0xffb5, .scancode = 0x4C },
377
378     /* KP_6 */
379     { .keysym = 0xffb6, .scancode = 0x4D },
380
381     /* KP_7 */
382     { .keysym = 0xffb7, .scancode = 0x47 },
383
384     /* KP_8 */
385     { .keysym = 0xffb8, .scancode = 0x48 },
386
387     /* KP_9 */
388     { .keysym = 0xffb9, .scancode = 0x49 },
389
390     /* Shift_L */
391     { .keysym = 0xffe1, .scancode = 0x2A },
392
393     /* Shift_R */
394     { .keysym = 0xffe2, .scancode = 0x36 },
395
396     /* Control_L */
397     { .keysym = 0xffe3, .scancode = 0x1D },
398
399     /* Control_R */
400     { .keysym = 0xffe4, .scancode = 0x1D },
401
402     /* Alt_L */
403     { .keysym = 0xffe9, .scancode = 0x38 },
404
405     /* Alt_R */
406     { .keysym = 0xffea, .scancode = 0x38 },
407
408     /* Super_L */
409     { .keysym = 0xffeb, .scancode = 0x5B,
410         .flags = KBD_FLAGS_EXTENDED },
411
412     /* Super_R */
413     { .keysym = 0xffec, .scancode = 0x5C,
414         .flags = KBD_FLAGS_EXTENDED },
415
416     /* Delete */
417     { .keysym = 0xffff, .scancode = 0x53,
418         .flags = KBD_FLAGS_EXTENDED },
419
420     {0}
421
422 };
423
424 const guac_rdp_keymap guac_rdp_keymap_en_us = {
425
426     .name = "en-us-qwerty",
427
428     .parent = NULL,
429     .mapping = __guac_rdp_keymap_mapping
430
431 };
432