VirtualBox

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

Last change on this file since 30204 was 29749, checked in by vboxsync, 15 years ago

Devices and FE/Common: keyboard table cleanup and a hack to support Sun keys on the emulated USB keyboard (Solaris host only)

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