2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
15 * The Original Code is libguac-client-rdp.
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2011
20 * the Initial Developer. All Rights Reserved.
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.
37 * ***** END LICENSE BLOCK ***** */
39 #include <freerdp/input.h>
40 #include <freerdp/locale/keyboard.h>
42 #include "rdp_keymap.h"
44 static guac_rdp_keysym_desc __guac_rdp_keymap_mapping[] = {
47 { .keysym = 0x0020, .scancode = 0x39 },
50 { .keysym = 0x0021, .scancode = 0x02,
51 .set_keysyms = GUAC_KEYSYMS_SHIFT },
54 { .keysym = 0x0022, .scancode = 0x28,
55 .set_keysyms = GUAC_KEYSYMS_SHIFT },
58 { .keysym = 0x0023, .scancode = 0x04,
59 .set_keysyms = GUAC_KEYSYMS_SHIFT },
62 { .keysym = 0x0024, .scancode = 0x05,
63 .set_keysyms = GUAC_KEYSYMS_SHIFT },
66 { .keysym = 0x0025, .scancode = 0x06,
67 .set_keysyms = GUAC_KEYSYMS_SHIFT },
70 { .keysym = 0x0026, .scancode = 0x08,
71 .set_keysyms = GUAC_KEYSYMS_SHIFT },
74 { .keysym = 0x0027, .scancode = 0x28 },
77 { .keysym = 0x0028, .scancode = 0x0A,
78 .set_keysyms = GUAC_KEYSYMS_SHIFT },
81 { .keysym = 0x0029, .scancode = 0x0B,
82 .set_keysyms = GUAC_KEYSYMS_SHIFT },
85 { .keysym = 0x002a, .scancode = 0x09,
86 .set_keysyms = GUAC_KEYSYMS_SHIFT },
89 { .keysym = 0x002b, .scancode = 0x0D,
90 .set_keysyms = GUAC_KEYSYMS_SHIFT },
93 { .keysym = 0x002c, .scancode = 0x33,
94 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
97 { .keysym = 0x002d, .scancode = 0x0C,
98 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
101 { .keysym = 0x002e, .scancode = 0x34,
102 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
105 { .keysym = 0x002f, .scancode = 0x35,
106 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
109 { .keysym = 0x0030, .scancode = 0x0B,
110 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
113 { .keysym = 0x0031, .scancode = 0x02,
114 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
117 { .keysym = 0x0032, .scancode = 0x03,
118 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
121 { .keysym = 0x0033, .scancode = 0x04,
122 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
125 { .keysym = 0x0034, .scancode = 0x05,
126 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
129 { .keysym = 0x0035, .scancode = 0x06,
130 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
133 { .keysym = 0x0036, .scancode = 0x07,
134 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
137 { .keysym = 0x0037, .scancode = 0x08,
138 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
141 { .keysym = 0x0038, .scancode = 0x09,
142 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
145 { .keysym = 0x0039, .scancode = 0x0A,
146 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
149 { .keysym = 0x003a, .scancode = 0x27,
150 .set_keysyms = GUAC_KEYSYMS_SHIFT },
153 { .keysym = 0x003b, .scancode = 0x27,
154 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
157 { .keysym = 0x003c, .scancode = 0x33,
158 .set_keysyms = GUAC_KEYSYMS_SHIFT },
161 { .keysym = 0x003d, .scancode = 0x0D,
162 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
165 { .keysym = 0x003e, .scancode = 0x34,
166 .set_keysyms = GUAC_KEYSYMS_SHIFT },
169 { .keysym = 0x003f, .scancode = 0x35,
170 .set_keysyms = GUAC_KEYSYMS_SHIFT },
173 { .keysym = 0x0040, .scancode = 0x03,
174 .set_keysyms = GUAC_KEYSYMS_SHIFT },
177 { .keysym = 0x0041, .scancode = 0x1E,
178 .set_keysyms = GUAC_KEYSYMS_SHIFT },
181 { .keysym = 0x0042, .scancode = 0x30,
182 .set_keysyms = GUAC_KEYSYMS_SHIFT },
185 { .keysym = 0x0043, .scancode = 0x2E,
186 .set_keysyms = GUAC_KEYSYMS_SHIFT },
189 { .keysym = 0x0044, .scancode = 0x20,
190 .set_keysyms = GUAC_KEYSYMS_SHIFT },
193 { .keysym = 0x0045, .scancode = 0x12,
194 .set_keysyms = GUAC_KEYSYMS_SHIFT },
197 { .keysym = 0x0046, .scancode = 0x21,
198 .set_keysyms = GUAC_KEYSYMS_SHIFT },
201 { .keysym = 0x0047, .scancode = 0x22,
202 .set_keysyms = GUAC_KEYSYMS_SHIFT },
205 { .keysym = 0x0048, .scancode = 0x23,
206 .set_keysyms = GUAC_KEYSYMS_SHIFT },
209 { .keysym = 0x0049, .scancode = 0x17,
210 .set_keysyms = GUAC_KEYSYMS_SHIFT },
213 { .keysym = 0x004a, .scancode = 0x24,
214 .set_keysyms = GUAC_KEYSYMS_SHIFT },
217 { .keysym = 0x004b, .scancode = 0x25,
218 .set_keysyms = GUAC_KEYSYMS_SHIFT },
221 { .keysym = 0x004c, .scancode = 0x26,
222 .set_keysyms = GUAC_KEYSYMS_SHIFT },
225 { .keysym = 0x004d, .scancode = 0x32,
226 .set_keysyms = GUAC_KEYSYMS_SHIFT },
229 { .keysym = 0x004e, .scancode = 0x31,
230 .set_keysyms = GUAC_KEYSYMS_SHIFT },
233 { .keysym = 0x004f, .scancode = 0x18,
234 .set_keysyms = GUAC_KEYSYMS_SHIFT },
237 { .keysym = 0x0050, .scancode = 0x19,
238 .set_keysyms = GUAC_KEYSYMS_SHIFT },
241 { .keysym = 0x0051, .scancode = 0x10,
242 .set_keysyms = GUAC_KEYSYMS_SHIFT },
245 { .keysym = 0x0052, .scancode = 0x13,
246 .set_keysyms = GUAC_KEYSYMS_SHIFT },
249 { .keysym = 0x0053, .scancode = 0x1F,
250 .set_keysyms = GUAC_KEYSYMS_SHIFT },
253 { .keysym = 0x0054, .scancode = 0x14,
254 .set_keysyms = GUAC_KEYSYMS_SHIFT },
257 { .keysym = 0x0055, .scancode = 0x16,
258 .set_keysyms = GUAC_KEYSYMS_SHIFT },
261 { .keysym = 0x0056, .scancode = 0x2F,
262 .set_keysyms = GUAC_KEYSYMS_SHIFT },
265 { .keysym = 0x0057, .scancode = 0x11,
266 .set_keysyms = GUAC_KEYSYMS_SHIFT },
269 { .keysym = 0x0058, .scancode = 0x2D,
270 .set_keysyms = GUAC_KEYSYMS_SHIFT },
273 { .keysym = 0x0059, .scancode = 0x15,
274 .set_keysyms = GUAC_KEYSYMS_SHIFT },
277 { .keysym = 0x005a, .scancode = 0x2C,
278 .set_keysyms = GUAC_KEYSYMS_SHIFT },
281 { .keysym = 0x005b, .scancode = 0x1A,
282 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
285 { .keysym = 0x005c, .scancode = 0x2B,
286 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
289 { .keysym = 0x005d, .scancode = 0x1B,
290 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
293 { .keysym = 0x005e, .scancode = 0x07,
294 .set_keysyms = GUAC_KEYSYMS_SHIFT },
297 { .keysym = 0x005f, .scancode = 0x0C,
298 .set_keysyms = GUAC_KEYSYMS_SHIFT },
301 { .keysym = 0x0060, .scancode = 0x29,
302 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
305 { .keysym = 0x0061, .scancode = 0x1E,
306 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
309 { .keysym = 0x0062, .scancode = 0x30,
310 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
313 { .keysym = 0x0063, .scancode = 0x2E,
314 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
317 { .keysym = 0x0064, .scancode = 0x20,
318 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
321 { .keysym = 0x0065, .scancode = 0x12,
322 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
325 { .keysym = 0x0066, .scancode = 0x21,
326 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
329 { .keysym = 0x0067, .scancode = 0x22,
330 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
333 { .keysym = 0x0068, .scancode = 0x23,
334 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
337 { .keysym = 0x0069, .scancode = 0x17,
338 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
341 { .keysym = 0x006a, .scancode = 0x24,
342 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
345 { .keysym = 0x006b, .scancode = 0x25,
346 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
349 { .keysym = 0x006c, .scancode = 0x26,
350 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
353 { .keysym = 0x006d, .scancode = 0x32,
354 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
357 { .keysym = 0x006e, .scancode = 0x31,
358 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
361 { .keysym = 0x006f, .scancode = 0x18,
362 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
365 { .keysym = 0x0070, .scancode = 0x19,
366 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
369 { .keysym = 0x0071, .scancode = 0x10,
370 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
373 { .keysym = 0x0072, .scancode = 0x13,
374 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
377 { .keysym = 0x0073, .scancode = 0x1F,
378 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
381 { .keysym = 0x0074, .scancode = 0x14,
382 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
385 { .keysym = 0x0075, .scancode = 0x16,
386 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
389 { .keysym = 0x0076, .scancode = 0x2F,
390 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
393 { .keysym = 0x0077, .scancode = 0x11,
394 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
397 { .keysym = 0x0078, .scancode = 0x2D,
398 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
401 { .keysym = 0x0079, .scancode = 0x15,
402 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
405 { .keysym = 0x007a, .scancode = 0x2C,
406 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
409 { .keysym = 0x007b, .scancode = 0x1A,
410 .set_keysyms = GUAC_KEYSYMS_SHIFT },
413 { .keysym = 0x007c, .scancode = 0x2B,
414 .set_keysyms = GUAC_KEYSYMS_SHIFT },
417 { .keysym = 0x007d, .scancode = 0x1B,
418 .set_keysyms = GUAC_KEYSYMS_SHIFT },
421 { .keysym = 0x007e, .scancode = 0x29,
422 .set_keysyms = GUAC_KEYSYMS_SHIFT },
428 const guac_rdp_keymap guac_rdp_keymap_en_us = {
430 .name = "en-us-qwerty",
432 .parent = &guac_rdp_keymap_base,
433 .mapping = __guac_rdp_keymap_mapping,
434 .freerdp_keyboard_layout = KBD_US