Check for freerdp/locale/keyboard.h before using it, default to old freerdp/kbd/layou...
[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 #ifdef HAVE_FREERDP_LOCALE_KEYBOARD_H
42 #include <freerdp/locale/keyboard.h>
43 #else
44 #include <freerdp/kbd/layouts.h>
45 #endif
46
47 #include "rdp_keymap.h"
48
49 static guac_rdp_keysym_desc __guac_rdp_keymap_mapping[] = {
50
51     /* space */
52     { .keysym = 0x0020, .scancode = 0x39 },
53
54     /* exclam */
55     { .keysym = 0x0021, .scancode = 0x02,
56         .set_keysyms = GUAC_KEYSYMS_SHIFT },
57
58     /* quotedbl */
59     { .keysym = 0x0022, .scancode = 0x28,
60         .set_keysyms = GUAC_KEYSYMS_SHIFT },
61
62     /* numbersign */
63     { .keysym = 0x0023, .scancode = 0x04,
64         .set_keysyms = GUAC_KEYSYMS_SHIFT },
65
66     /* dollar */
67     { .keysym = 0x0024, .scancode = 0x05,
68         .set_keysyms = GUAC_KEYSYMS_SHIFT },
69
70     /* percent */
71     { .keysym = 0x0025, .scancode = 0x06,
72         .set_keysyms = GUAC_KEYSYMS_SHIFT },
73
74     /* ampersand */
75     { .keysym = 0x0026, .scancode = 0x08,
76         .set_keysyms = GUAC_KEYSYMS_SHIFT },
77
78     /* quoteright */
79     { .keysym = 0x0027, .scancode = 0x28 },
80
81     /* parenleft */
82     { .keysym = 0x0028, .scancode = 0x0A,
83         .set_keysyms = GUAC_KEYSYMS_SHIFT },
84
85     /* parenright */
86     { .keysym = 0x0029, .scancode = 0x0B,
87         .set_keysyms = GUAC_KEYSYMS_SHIFT },
88
89     /* asterisk */
90     { .keysym = 0x002a, .scancode = 0x09,
91         .set_keysyms = GUAC_KEYSYMS_SHIFT },
92
93     /* plus */
94     { .keysym = 0x002b, .scancode = 0x0D,
95         .set_keysyms = GUAC_KEYSYMS_SHIFT },
96
97     /* comma */
98     { .keysym = 0x002c, .scancode = 0x33,
99         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
100
101     /* minus */
102     { .keysym = 0x002d, .scancode = 0x0C,
103         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
104
105     /* period */
106     { .keysym = 0x002e, .scancode = 0x34,
107         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
108
109     /* slash */
110     { .keysym = 0x002f, .scancode = 0x35,
111         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
112
113     /* 0 */
114     { .keysym = 0x0030, .scancode = 0x0B,
115         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
116
117     /* 1 */
118     { .keysym = 0x0031, .scancode = 0x02,
119         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
120
121     /* 2 */
122     { .keysym = 0x0032, .scancode = 0x03,
123         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
124
125     /* 3 */
126     { .keysym = 0x0033, .scancode = 0x04,
127         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
128
129     /* 4 */
130     { .keysym = 0x0034, .scancode = 0x05,
131         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
132
133     /* 5 */
134     { .keysym = 0x0035, .scancode = 0x06,
135         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
136
137     /* 6 */
138     { .keysym = 0x0036, .scancode = 0x07,
139         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
140
141     /* 7 */
142     { .keysym = 0x0037, .scancode = 0x08,
143         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
144
145     /* 8 */
146     { .keysym = 0x0038, .scancode = 0x09,
147         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
148
149     /* 9 */
150     { .keysym = 0x0039, .scancode = 0x0A,
151         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
152
153     /* colon */
154     { .keysym = 0x003a, .scancode = 0x27,
155         .set_keysyms = GUAC_KEYSYMS_SHIFT },
156
157     /* semicolon */
158     { .keysym = 0x003b, .scancode = 0x27,
159         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
160
161     /* less */
162     { .keysym = 0x003c, .scancode = 0x33,
163         .set_keysyms = GUAC_KEYSYMS_SHIFT },
164
165     /* equal */
166     { .keysym = 0x003d, .scancode = 0x0D,
167         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
168
169     /* greater */
170     { .keysym = 0x003e, .scancode = 0x34,
171         .set_keysyms = GUAC_KEYSYMS_SHIFT },
172
173     /* question */
174     { .keysym = 0x003f, .scancode = 0x35,
175         .set_keysyms = GUAC_KEYSYMS_SHIFT },
176
177     /* at */
178     { .keysym = 0x0040, .scancode = 0x03,
179         .set_keysyms = GUAC_KEYSYMS_SHIFT },
180
181     /* A */
182     { .keysym = 0x0041, .scancode = 0x1E,
183         .set_keysyms = GUAC_KEYSYMS_SHIFT },
184
185     /* B */
186     { .keysym = 0x0042, .scancode = 0x30,
187         .set_keysyms = GUAC_KEYSYMS_SHIFT },
188
189     /* C */
190     { .keysym = 0x0043, .scancode = 0x2E,
191         .set_keysyms = GUAC_KEYSYMS_SHIFT },
192
193     /* D */
194     { .keysym = 0x0044, .scancode = 0x20,
195         .set_keysyms = GUAC_KEYSYMS_SHIFT },
196
197     /* E */
198     { .keysym = 0x0045, .scancode = 0x12,
199         .set_keysyms = GUAC_KEYSYMS_SHIFT },
200
201     /* F */
202     { .keysym = 0x0046, .scancode = 0x21,
203         .set_keysyms = GUAC_KEYSYMS_SHIFT },
204
205     /* G */
206     { .keysym = 0x0047, .scancode = 0x22,
207         .set_keysyms = GUAC_KEYSYMS_SHIFT },
208
209     /* H */
210     { .keysym = 0x0048, .scancode = 0x23,
211         .set_keysyms = GUAC_KEYSYMS_SHIFT },
212
213     /* I */
214     { .keysym = 0x0049, .scancode = 0x17,
215         .set_keysyms = GUAC_KEYSYMS_SHIFT },
216
217     /* J */
218     { .keysym = 0x004a, .scancode = 0x24,
219         .set_keysyms = GUAC_KEYSYMS_SHIFT },
220
221     /* K */
222     { .keysym = 0x004b, .scancode = 0x25,
223         .set_keysyms = GUAC_KEYSYMS_SHIFT },
224
225     /* L */
226     { .keysym = 0x004c, .scancode = 0x26,
227         .set_keysyms = GUAC_KEYSYMS_SHIFT },
228
229     /* M */
230     { .keysym = 0x004d, .scancode = 0x32,
231         .set_keysyms = GUAC_KEYSYMS_SHIFT },
232
233     /* N */
234     { .keysym = 0x004e, .scancode = 0x31,
235         .set_keysyms = GUAC_KEYSYMS_SHIFT },
236
237     /* O */
238     { .keysym = 0x004f, .scancode = 0x18,
239         .set_keysyms = GUAC_KEYSYMS_SHIFT },
240
241     /* P */
242     { .keysym = 0x0050, .scancode = 0x19,
243         .set_keysyms = GUAC_KEYSYMS_SHIFT },
244
245     /* Q */
246     { .keysym = 0x0051, .scancode = 0x10,
247         .set_keysyms = GUAC_KEYSYMS_SHIFT },
248
249     /* R */
250     { .keysym = 0x0052, .scancode = 0x13,
251         .set_keysyms = GUAC_KEYSYMS_SHIFT },
252
253     /* S */
254     { .keysym = 0x0053, .scancode = 0x1F,
255         .set_keysyms = GUAC_KEYSYMS_SHIFT },
256
257     /* T */
258     { .keysym = 0x0054, .scancode = 0x14,
259         .set_keysyms = GUAC_KEYSYMS_SHIFT },
260
261     /* U */
262     { .keysym = 0x0055, .scancode = 0x16,
263         .set_keysyms = GUAC_KEYSYMS_SHIFT },
264
265     /* V */
266     { .keysym = 0x0056, .scancode = 0x2F,
267         .set_keysyms = GUAC_KEYSYMS_SHIFT },
268
269     /* W */
270     { .keysym = 0x0057, .scancode = 0x11,
271         .set_keysyms = GUAC_KEYSYMS_SHIFT },
272
273     /* X */
274     { .keysym = 0x0058, .scancode = 0x2D,
275         .set_keysyms = GUAC_KEYSYMS_SHIFT },
276
277     /* Y */
278     { .keysym = 0x0059, .scancode = 0x15,
279         .set_keysyms = GUAC_KEYSYMS_SHIFT },
280
281     /* Z */
282     { .keysym = 0x005a, .scancode = 0x2C,
283         .set_keysyms = GUAC_KEYSYMS_SHIFT },
284
285     /* bracketleft */
286     { .keysym = 0x005b, .scancode = 0x1A,
287         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
288
289     /* backslash */
290     { .keysym = 0x005c, .scancode = 0x2B,
291         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
292
293     /* bracketright */
294     { .keysym = 0x005d, .scancode = 0x1B,
295         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
296
297     /* asciicircum */
298     { .keysym = 0x005e, .scancode = 0x07,
299         .set_keysyms = GUAC_KEYSYMS_SHIFT },
300
301     /* underscore */
302     { .keysym = 0x005f, .scancode = 0x0C,
303         .set_keysyms = GUAC_KEYSYMS_SHIFT },
304
305     /* quoteleft */
306     { .keysym = 0x0060, .scancode = 0x29,
307         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
308
309     /* a */
310     { .keysym = 0x0061, .scancode = 0x1E,
311         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
312
313     /* b */
314     { .keysym = 0x0062, .scancode = 0x30,
315         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
316
317     /* c */
318     { .keysym = 0x0063, .scancode = 0x2E,
319         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
320
321     /* d */
322     { .keysym = 0x0064, .scancode = 0x20,
323         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
324
325     /* e */
326     { .keysym = 0x0065, .scancode = 0x12,
327         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
328
329     /* f */
330     { .keysym = 0x0066, .scancode = 0x21,
331         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
332
333     /* g */
334     { .keysym = 0x0067, .scancode = 0x22,
335         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
336
337     /* h */
338     { .keysym = 0x0068, .scancode = 0x23,
339         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
340
341     /* i */
342     { .keysym = 0x0069, .scancode = 0x17,
343         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
344
345     /* j */
346     { .keysym = 0x006a, .scancode = 0x24,
347         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
348
349     /* k */
350     { .keysym = 0x006b, .scancode = 0x25,
351         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
352
353     /* l */
354     { .keysym = 0x006c, .scancode = 0x26,
355         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
356
357     /* m */
358     { .keysym = 0x006d, .scancode = 0x32,
359         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
360
361     /* n */
362     { .keysym = 0x006e, .scancode = 0x31,
363         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
364
365     /* o */
366     { .keysym = 0x006f, .scancode = 0x18,
367         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
368
369     /* p */
370     { .keysym = 0x0070, .scancode = 0x19,
371         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
372
373     /* q */
374     { .keysym = 0x0071, .scancode = 0x10,
375         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
376
377     /* r */
378     { .keysym = 0x0072, .scancode = 0x13,
379         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
380
381     /* s */
382     { .keysym = 0x0073, .scancode = 0x1F,
383         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
384
385     /* t */
386     { .keysym = 0x0074, .scancode = 0x14,
387         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
388
389     /* u */
390     { .keysym = 0x0075, .scancode = 0x16,
391         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
392
393     /* v */
394     { .keysym = 0x0076, .scancode = 0x2F,
395         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
396
397     /* w */
398     { .keysym = 0x0077, .scancode = 0x11,
399         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
400
401     /* x */
402     { .keysym = 0x0078, .scancode = 0x2D,
403         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
404
405     /* y */
406     { .keysym = 0x0079, .scancode = 0x15,
407         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
408
409     /* z */
410     { .keysym = 0x007a, .scancode = 0x2C,
411         .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
412
413     /* braceleft */
414     { .keysym = 0x007b, .scancode = 0x1A,
415         .set_keysyms = GUAC_KEYSYMS_SHIFT },
416
417     /* bar */
418     { .keysym = 0x007c, .scancode = 0x2B,
419         .set_keysyms = GUAC_KEYSYMS_SHIFT },
420
421     /* braceright */
422     { .keysym = 0x007d, .scancode = 0x1B,
423         .set_keysyms = GUAC_KEYSYMS_SHIFT },
424
425     /* asciitilde */
426     { .keysym = 0x007e, .scancode = 0x29,
427         .set_keysyms = GUAC_KEYSYMS_SHIFT },
428
429     {0}
430
431 };
432
433 const guac_rdp_keymap guac_rdp_keymap_en_us = {
434
435     .name = "en-us-qwerty",
436
437     .parent = &guac_rdp_keymap_base,
438     .mapping = __guac_rdp_keymap_mapping,
439     .freerdp_keyboard_layout = KBD_US
440
441 };
442