VirtualBox

source: vbox/trunk/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-tables.h@ 33595

Last change on this file since 33595 was 32874, checked in by vboxsync, 14 years ago

FE/Common/VBoxKeyboard: try to use XKB to determine the keyboard layout as well, and by default

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.7 KB
Line 
1/* $Id: keyboard-tables.h 32874 2010-10-01 16:50:10Z vboxsync $ */
2/** @file
3 * VBox/Frontends/Common - X11 keyboard driver translation tables.
4 */
5
6/* This code is originally from the Wine project. It was split off from
7 keyboard-new.c. (See the copyrights in that file). */
8
9/*
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25/*
26 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
27 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
28 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
29 * a choice of LGPL license versions is made available with the language indicating
30 * that LGPLv2 or any later version may be used, or where a choice of which version
31 * of the LGPL is applied is otherwise unspecified.
32 */
33
34#ifndef ___VBox_keyboard_tables_h
35# define ___VBox_keyboard_tables_h
36
37#define MAIN_LEN 50
38static const unsigned main_key_scan[MAIN_LEN] =
39{
40 /* ` 1 2 3 4 5 6 7 8 9 0 - = */
41 0x29,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,
42 /* q w e r t y u i o p [ ] */
43 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,
44 /* a s d f g h j k l ; ' \ */
45 0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2B,
46 /* z x c v b n m , . / */
47 0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
48 /* 102nd key Brazilian key Yen */
49 0x56, 0x73, 0x7d
50};
51
52/*** DEFINE YOUR NEW LANGUAGE-SPECIFIC MAPPINGS BELOW, SEE EXISTING TABLES */
53
54/* order: Normal, Shift */
55/* We recommend you write just what is guaranteed to be correct (i.e. what's
56 written on the keycaps), not the bunch of special characters behind AltGr
57 and Shift-AltGr if it can vary among different X servers */
58/* Remember to also add your new table to the layout index table below! */
59
60#include "keyboard-layouts.h"
61
62/*** Layout table. Add your keyboard mappings to this list */
63static const struct {
64 const char *comment;
65 const char (*key)[MAIN_LEN][2];
66} main_key_tab[]={
67#include "keyboard-list.h"
68 {NULL, NULL} /* sentinel */
69};
70
71/* Scan code table for non-character keys */
72
73static const unsigned nonchar_key_scan[256] =
74{
75 /* unused */
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF00 */
77 /* special keys */
78 0x0E, 0x0F, 0x00, /*?*/ 0, 0x00, 0x1C, 0x00, 0x00, /* FF08 */
79 0x00, 0x00, 0x00, 0x45, 0x46, 0x00, 0x00, 0x00, /* FF10 */
80 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* FF18 */
81 /* Sun Menu, additional Japanese keys */
82#ifdef sun
83 0x15D, 0x79, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, /* FF20 */
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, /* FF28 */
85#else
86 0x15D, 0x00, 0x7B, 0x79, 0x00, 0x00, 0x00, 0x70, /* FF20 */
87 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF28 */
88#endif /* sun */
89 /* additional Korean keys */
90 0x00, 0xF2, 0x00, 0x00, 0xF1, 0x00, 0x00, 0x00, /* FF30 */
91 /* unused */
92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF38 */
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF40 */
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF48 */
95 /* cursor keys */
96 0x147, 0x14B, 0x148, 0x14D, 0x150, 0x149, 0x151, 0x14F, /* FF50 */
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF58 */
98 /* misc keys */
99 /* Menu */
100#ifdef sun
101 /*?*/ 0, 0x137, 0x7b, 0x152, 0x00, 0x00, 0x00, 0x15D, /* FF60 */
102#else
103 /*?*/ 0, 0x137, 0, 0x152, 0x00, 0x00, 0x00, 0x15D, /* FF60 */
104#endif /* sun */
105 /* Help */
106 0x00, 0x00, 0x13B, 0x146, 0x00, 0x00, 0x00, 0x00, /* FF68 */
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF70 */
108 /* keypad keys */
109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x138, 0x145, /* FF78 */
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF80 */
111 0x00, 0x00, 0x00, 0x00, 0x00, 0x11C, 0x00, 0x00, /* FF88 */
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x4B, 0x48, /* FF90 */
113 0x4D, 0x50, 0x49, 0x51, 0x4F, 0x4C, 0x52, 0x53, /* FF98 */
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFA0 */
115 0x00, 0x00, 0x37, 0x4E, 0x53, 0x4A, 0x7e, 0x135, /* FFA8 */
116 0x52, 0x4F, 0x50, 0x51, 0x4B, 0x4C, 0x4D, 0x47, /* FFB0 */
117 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, /* FFB8 */
118 /* function keys (F1 to F12) */
119 0x3B, 0x3C,
120 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, /* FFC0 */
121#ifdef sun
122 /* On Solaris, F11 to F20 are actually keys on the left function block.
123 * Since just one of them has a set 1 PS/2 scan code, we arbitrarily assign
124 * the rest scan codes which are extended versions of F2 to F10. With
125 * the emulated PS/2 keyboard this will not help anyone, but with the
126 * emulated USB one we can translate them to the proper USB scan codes. */
127 0x13C, 0x13D, 0x72, 0x13E, 0x13F, 0x140, 0x141, 0x142, /* FFC8 */
128 0x143, 0x144, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFD0 */
129#else
130 0x57, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFC8 */
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFD0 */
132#endif
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFD8 */
134 /* modifier keys */
135 0x00, 0x2A, 0x36, 0x1D, 0x11D, 0x3A, 0x00, 0x15B, /* FFE0 */
136 0x15C, 0x38, 0x138, 0x15B, 0x15C, 0x00, 0x00, 0x00, /* FFE8 */
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFF0 */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x153 /* FFF8 */
139};
140
141/* This list was put together using /usr/include/X11/XF86keysym.h and
142 http://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html. It has not yet
143 been extensively tested. The scancodes are those used by MicroSoft
144 keyboards. */
145static const unsigned xfree86_vendor_key_scan[256] =
146{
147 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF00 */
148 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF08 */
149 /* Vol- Mute Vol+ Play Stop Track- Track+ */
150 0, 0x12e, 0x120, 0x130, 0x122, 0x124, 0x110, 0x119, /* 1008FF10 */
151 /* Home E-mail Search */
152 0x132, 0x16c, 0, 0x165, 0, 0, 0, 0, /* 1008FF18 */
153 /* Calndr PwrDown Back Forward */
154 0x115, 0x15e, 0, 0, 0, 0, 0x16a, 0x169, /* 1008FF20 */
155 /* Stop Refresh Power Wake Sleep */
156 0x168, 0x167, 0x15e, 0x163, 0, 0, 0, 0x15f, /* 1008FF28 */
157 /* Favrts Pause Media MyComp */
158 0x166, 0x122, 0x16d, 0x16b, 0, 0, 0, 0, /* 1008FF30 */
159 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF38 */
160 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF40 */
161 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF48 */
162 /* AppL AppR Calc Close Copy */
163 0x109, 0x11e, 0, 0, 0x121, 0, 0x140, 0x118, /* 1008FF50 */
164 /* Cut Docmnts Excel */
165 0x117, 0, 0, 0x105, 0x114, 0, 0, 0, /* 1008FF58 */
166 /* LogOff */
167 0, 0x116, 0, 0, 0, 0, 0, 0, /* 1008FF60 */
168 /* OffcHm Open Paste */
169 0, 0, 0x13c, 0x13f, 0, 0x10a, 0, 0, /* 1008FF68 */
170 /* Reply Refresh Save */
171 0, 0, 0x141, 0x167, 0, 0, 0, 0x157, /* 1008FF70 */
172 /* ScrlUp ScrlDn Send Spell TaskPane */
173 0x10b, 0x18b, 0, 0x143, 0x123, 0, 0, 0x13d, /* 1008FF78 */
174 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF80 */
175 /* Word */
176 0, 0x113, 0, 0, 0, 0, 0, 0, /* 1008FF88 */
177 /* MailFwd MyPics MyMusic*/
178 0x142, 0x164, 0x13c, 0, 0, 0, 0, 0, /* 1008FF90 */
179 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF98 */
180 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFA0 */
181 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFA8 */
182 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFB0 */
183 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFB8 */
184 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFC0 */
185 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFC8 */
186 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFD0 */
187 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFD8 */
188 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFE0 */
189 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFE8 */
190 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFF0 */
191 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */
192};
193
194/* This list was put together using /usr/include/X11/Sunkeysym.h and
195 comparing the scancodes produced by a Sun type 7 USB keyboard. Note that
196 Sun call F11 and F12 F36 and F37 respectively, as they already had 35
197 function keys when those two physical keys were added. */
198static const unsigned sun_key_scan[256] =
199{
200 /* FAGrav, FACirc, FATild, FAAcut, FADiae, FACed */
201 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF00 */
202 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF08 */
203 /* SunF36, SunF37 */
204 0x57, 0x58, 0, 0, 0, 0, 0, 0, /* 1005FF10 */
205 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF18 */
206 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF20 */
207 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF28 */
208 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF30 */
209 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF38 */
210 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF40 */
211 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF48 */
212 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF50 */
213 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF58 */
214 /* SysReq */
215 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF60 */
216 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF68 */
217 /* Props Front Copy Paste Cut Power Vol- Mute */
218 0x106, 0x10c, 0x178, 0x65, 0x13c, 0x15e, 0x12e, 0x120, /* 1005FF70 */
219 /* Vol+ */
220 0x130, 0, 0, 0, 0, 0, 0, 0, /* 1005FF78 */
221 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF80 */
222 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF88 */
223 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF90 */
224 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF98 */
225 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFA0 */
226 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFA8 */
227 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFB0 */
228 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFB8 */
229 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFC0 */
230 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFC8 */
231 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFD0 */
232 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFD8 */
233 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFE0 */
234 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFE8 */
235 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFF0 */
236 0, 0, 0, 0, 0, 0, 0, 0 /* 1005FFF8 */
237};
238
239#include "xkbtoscan.h"
240
241#endif /* !___VBox_keyboard_tables_h */
242
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette