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>
41 #include <freerdp/locale/keyboard.h>
43 #include "rdp_keymap.h"
45 static guac_rdp_keysym_desc __guac_rdp_keymap_mapping[] = {
48 { .keysym = 0x0020, .scancode = 0x39 },
51 { .keysym = 0x0021, .scancode = 0x02,
52 .set_keysyms = GUAC_KEYSYMS_SHIFT },
55 { .keysym = 0x0022, .scancode = 0x28,
56 .set_keysyms = GUAC_KEYSYMS_SHIFT },
59 { .keysym = 0x0023, .scancode = 0x04,
60 .set_keysyms = GUAC_KEYSYMS_SHIFT },
63 { .keysym = 0x0024, .scancode = 0x05,
64 .set_keysyms = GUAC_KEYSYMS_SHIFT },
67 { .keysym = 0x0025, .scancode = 0x06,
68 .set_keysyms = GUAC_KEYSYMS_SHIFT },
71 { .keysym = 0x0026, .scancode = 0x08,
72 .set_keysyms = GUAC_KEYSYMS_SHIFT },
75 { .keysym = 0x0027, .scancode = 0x28 },
78 { .keysym = 0x0028, .scancode = 0x0A,
79 .set_keysyms = GUAC_KEYSYMS_SHIFT },
82 { .keysym = 0x0029, .scancode = 0x0B,
83 .set_keysyms = GUAC_KEYSYMS_SHIFT },
86 { .keysym = 0x002a, .scancode = 0x09,
87 .set_keysyms = GUAC_KEYSYMS_SHIFT },
90 { .keysym = 0x002b, .scancode = 0x0D,
91 .set_keysyms = GUAC_KEYSYMS_SHIFT },
94 { .keysym = 0x002c, .scancode = 0x33,
95 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
98 { .keysym = 0x002d, .scancode = 0x0C,
99 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
102 { .keysym = 0x002e, .scancode = 0x34,
103 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
106 { .keysym = 0x002f, .scancode = 0x35,
107 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
110 { .keysym = 0x0030, .scancode = 0x0B,
111 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
114 { .keysym = 0x0031, .scancode = 0x02,
115 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
118 { .keysym = 0x0032, .scancode = 0x03,
119 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
122 { .keysym = 0x0033, .scancode = 0x04,
123 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
126 { .keysym = 0x0034, .scancode = 0x05,
127 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
130 { .keysym = 0x0035, .scancode = 0x06,
131 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
134 { .keysym = 0x0036, .scancode = 0x07,
135 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
138 { .keysym = 0x0037, .scancode = 0x08,
139 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
142 { .keysym = 0x0038, .scancode = 0x09,
143 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
146 { .keysym = 0x0039, .scancode = 0x0A,
147 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
150 { .keysym = 0x003a, .scancode = 0x27,
151 .set_keysyms = GUAC_KEYSYMS_SHIFT },
154 { .keysym = 0x003b, .scancode = 0x27,
155 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
158 { .keysym = 0x003c, .scancode = 0x33,
159 .set_keysyms = GUAC_KEYSYMS_SHIFT },
162 { .keysym = 0x003d, .scancode = 0x0D,
163 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
166 { .keysym = 0x003e, .scancode = 0x34,
167 .set_keysyms = GUAC_KEYSYMS_SHIFT },
170 { .keysym = 0x003f, .scancode = 0x35,
171 .set_keysyms = GUAC_KEYSYMS_SHIFT },
174 { .keysym = 0x0040, .scancode = 0x03,
175 .set_keysyms = GUAC_KEYSYMS_SHIFT },
178 { .keysym = 0x0041, .scancode = 0x1E,
179 .set_keysyms = GUAC_KEYSYMS_SHIFT },
182 { .keysym = 0x0042, .scancode = 0x30,
183 .set_keysyms = GUAC_KEYSYMS_SHIFT },
186 { .keysym = 0x0043, .scancode = 0x2E,
187 .set_keysyms = GUAC_KEYSYMS_SHIFT },
190 { .keysym = 0x0044, .scancode = 0x20,
191 .set_keysyms = GUAC_KEYSYMS_SHIFT },
194 { .keysym = 0x0045, .scancode = 0x12,
195 .set_keysyms = GUAC_KEYSYMS_SHIFT },
198 { .keysym = 0x0046, .scancode = 0x21,
199 .set_keysyms = GUAC_KEYSYMS_SHIFT },
202 { .keysym = 0x0047, .scancode = 0x22,
203 .set_keysyms = GUAC_KEYSYMS_SHIFT },
206 { .keysym = 0x0048, .scancode = 0x23,
207 .set_keysyms = GUAC_KEYSYMS_SHIFT },
210 { .keysym = 0x0049, .scancode = 0x17,
211 .set_keysyms = GUAC_KEYSYMS_SHIFT },
214 { .keysym = 0x004a, .scancode = 0x24,
215 .set_keysyms = GUAC_KEYSYMS_SHIFT },
218 { .keysym = 0x004b, .scancode = 0x25,
219 .set_keysyms = GUAC_KEYSYMS_SHIFT },
222 { .keysym = 0x004c, .scancode = 0x26,
223 .set_keysyms = GUAC_KEYSYMS_SHIFT },
226 { .keysym = 0x004d, .scancode = 0x32,
227 .set_keysyms = GUAC_KEYSYMS_SHIFT },
230 { .keysym = 0x004e, .scancode = 0x31,
231 .set_keysyms = GUAC_KEYSYMS_SHIFT },
234 { .keysym = 0x004f, .scancode = 0x18,
235 .set_keysyms = GUAC_KEYSYMS_SHIFT },
238 { .keysym = 0x0050, .scancode = 0x19,
239 .set_keysyms = GUAC_KEYSYMS_SHIFT },
242 { .keysym = 0x0051, .scancode = 0x10,
243 .set_keysyms = GUAC_KEYSYMS_SHIFT },
246 { .keysym = 0x0052, .scancode = 0x13,
247 .set_keysyms = GUAC_KEYSYMS_SHIFT },
250 { .keysym = 0x0053, .scancode = 0x1F,
251 .set_keysyms = GUAC_KEYSYMS_SHIFT },
254 { .keysym = 0x0054, .scancode = 0x14,
255 .set_keysyms = GUAC_KEYSYMS_SHIFT },
258 { .keysym = 0x0055, .scancode = 0x16,
259 .set_keysyms = GUAC_KEYSYMS_SHIFT },
262 { .keysym = 0x0056, .scancode = 0x2F,
263 .set_keysyms = GUAC_KEYSYMS_SHIFT },
266 { .keysym = 0x0057, .scancode = 0x11,
267 .set_keysyms = GUAC_KEYSYMS_SHIFT },
270 { .keysym = 0x0058, .scancode = 0x2D,
271 .set_keysyms = GUAC_KEYSYMS_SHIFT },
274 { .keysym = 0x0059, .scancode = 0x15,
275 .set_keysyms = GUAC_KEYSYMS_SHIFT },
278 { .keysym = 0x005a, .scancode = 0x2C,
279 .set_keysyms = GUAC_KEYSYMS_SHIFT },
282 { .keysym = 0x005b, .scancode = 0x1A,
283 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
286 { .keysym = 0x005c, .scancode = 0x2B,
287 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
290 { .keysym = 0x005d, .scancode = 0x1B,
291 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
294 { .keysym = 0x005e, .scancode = 0x07,
295 .set_keysyms = GUAC_KEYSYMS_SHIFT },
298 { .keysym = 0x005f, .scancode = 0x0C,
299 .set_keysyms = GUAC_KEYSYMS_SHIFT },
302 { .keysym = 0x0060, .scancode = 0x29,
303 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
306 { .keysym = 0x0061, .scancode = 0x1E,
307 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
310 { .keysym = 0x0062, .scancode = 0x30,
311 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
314 { .keysym = 0x0063, .scancode = 0x2E,
315 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
318 { .keysym = 0x0064, .scancode = 0x20,
319 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
322 { .keysym = 0x0065, .scancode = 0x12,
323 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
326 { .keysym = 0x0066, .scancode = 0x21,
327 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
330 { .keysym = 0x0067, .scancode = 0x22,
331 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
334 { .keysym = 0x0068, .scancode = 0x23,
335 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
338 { .keysym = 0x0069, .scancode = 0x17,
339 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
342 { .keysym = 0x006a, .scancode = 0x24,
343 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
346 { .keysym = 0x006b, .scancode = 0x25,
347 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
350 { .keysym = 0x006c, .scancode = 0x26,
351 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
354 { .keysym = 0x006d, .scancode = 0x32,
355 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
358 { .keysym = 0x006e, .scancode = 0x31,
359 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
362 { .keysym = 0x006f, .scancode = 0x18,
363 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
366 { .keysym = 0x0070, .scancode = 0x19,
367 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
370 { .keysym = 0x0071, .scancode = 0x10,
371 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
374 { .keysym = 0x0072, .scancode = 0x13,
375 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
378 { .keysym = 0x0073, .scancode = 0x1F,
379 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
382 { .keysym = 0x0074, .scancode = 0x14,
383 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
386 { .keysym = 0x0075, .scancode = 0x16,
387 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
390 { .keysym = 0x0076, .scancode = 0x2F,
391 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
394 { .keysym = 0x0077, .scancode = 0x11,
395 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
398 { .keysym = 0x0078, .scancode = 0x2D,
399 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
402 { .keysym = 0x0079, .scancode = 0x15,
403 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
406 { .keysym = 0x007a, .scancode = 0x2C,
407 .clear_keysyms = GUAC_KEYSYMS_ALL_SHIFT },
410 { .keysym = 0x007b, .scancode = 0x1A,
411 .set_keysyms = GUAC_KEYSYMS_SHIFT },
414 { .keysym = 0x007c, .scancode = 0x2B,
415 .set_keysyms = GUAC_KEYSYMS_SHIFT },
418 { .keysym = 0x007d, .scancode = 0x1B,
419 .set_keysyms = GUAC_KEYSYMS_SHIFT },
422 { .keysym = 0x007e, .scancode = 0x29,
423 .set_keysyms = GUAC_KEYSYMS_SHIFT },
429 const guac_rdp_keymap guac_rdp_keymap_en_us = {
431 .name = "en-us-qwerty",
433 .parent = &guac_rdp_keymap_base,
434 .mapping = __guac_rdp_keymap_mapping,
435 .freerdp_keyboard_layout = KBD_US