VirtualBox

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

Last change on this file since 47908 was 40392, checked in by vboxsync, 13 years ago

Devices/keyboards: try to better support Sun function keys, take 2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.0 KB
Line 
1/* $Id: keyboard-tables.h 40392 2012-03-07 14:16:40Z 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 * Oracle 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, Oracle 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/** @note On the whole we use Microsoft's "USB HID to PS/2 Scan Code
72 * Translation Table" and
73 * http://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html
74 * as a reference for scan code numbers.
75 * Sun keyboards have eleven additional keys on the left-hand side.
76 * These keys never had PC scan codes assigned to them. We map all X11
77 * keycodes which can correspond to these keys to the PC scan codes for
78 * F13 to F23 (as per Microsoft's translation table) and the USB keyboard
79 * code translates them back to the correct usage codes. */
80
81/* Scan code table for non-character keys */
82static const unsigned nonchar_key_scan[256] =
83{
84 /* unused */
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF00 */
86 /* special keys */
87 0x0E, 0x0F, 0x00, /*?*/ 0, 0x00, 0x1C, 0x00, 0x00, /* FF08 */
88 0x00, 0x00, 0x00, 0x145, 0x46, 0x00, 0x00, 0x00, /* FF10 */
89 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* FF18 */
90 /* Sun Menu, additional Japanese keys */
91#ifdef sun
92 0x15D, 0x79, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, /* FF20 */
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, /* FF28 */
94#else
95 0x15D, 0x00, 0x7B, 0x79, 0x00, 0x00, 0x00, 0x70, /* FF20 */
96 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF28 */
97#endif /* sun */
98 /* additional Korean keys */
99 0x00, 0xF2, 0x00, 0x00, 0xF1, 0x00, 0x00, 0x00, /* FF30 */
100 /* unused */
101 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF38 */
102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF40 */
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF48 */
104 /* cursor keys */
105 0x147, 0x14B, 0x148, 0x14D, 0x150, 0x149, 0x151, 0x14F, /* FF50 */
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF58 */
107 /* misc keys */
108 /* Print Open Insert Undo Again Menu */
109 /* ->F17 ->F14 ->F22 */
110 0x00, 0x137, 0x68, 0x152, 0x00, 0x65, 0x6d, 0x15D, /* FF60 */
111 /* Find Stop Help Break */
112 /* ->F19 ->F21 ->F23 */
113 0x6a, 0x6c, 0x6e, 0x146, 0x00, 0x00, 0x00, 0x00, /* FF68 */
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF70 */
115 /* keypad keys */
116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x138, 0x45, /* FF78 */
117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF80 */
118 0x00, 0x00, 0x00, 0x00, 0x00, 0x11C, 0x00, 0x00, /* FF88 */
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x4B, 0x48, /* FF90 */
120 0x4D, 0x50, 0x49, 0x51, 0x4F, 0x4C, 0x52, 0x53, /* FF98 */
121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFA0 */
122 0x00, 0x00, 0x37, 0x4E, 0x53, 0x4A, 0x7e, 0x135, /* FFA8 */
123 0x52, 0x4F, 0x50, 0x51, 0x4B, 0x4C, 0x4D, 0x47, /* FFB0 */
124 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, /* FFB8 */
125 /* function keys (F1 to F12) */
126 0x3B, 0x3C,
127 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, /* FFC0 */
128#ifdef sun
129 /* Stop Again F13 F14 F15 F16 F17 F18 */
130 /* ->F21 ->F22 */
131 0x6c, 0x6d, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, /* FFC8 */
132#else
133 /* F11 F12 */
134 0x57, 0x58, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, /* FFC8 */
135#endif
136 /* F19 F20 F21 F22 F23 F24 */
137 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x76, 0x00, 0x00, /* FFD0 */
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFD8 */
139 /* modifier keys */
140 0x00, 0x2A, 0x36, 0x1D, 0x11D, 0x3A, 0x00, 0x15B, /* FFE0 */
141 0x15C, 0x38, 0x138, 0x15B, 0x15C, 0x00, 0x00, 0x00, /* FFE8 */
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFF0 */
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x153 /* FFF8 */
144};
145
146/* This list was put together using /usr/include/X11/XF86keysym.h and
147 the documents referenced above for scan code numbers. It has not yet
148 been extensively tested. The scancodes are those used by MicroSoft
149 keyboards. */
150static const unsigned xfree86_vendor_key_scan[256] =
151{
152 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF00 */
153 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF08 */
154 /* Vol- Mute Vol+ Play Stop Track- Track+ */
155 0, 0x12e, 0x120, 0x130, 0x122, 0x124, 0x110, 0x119, /* 1008FF10 */
156 /* Home E-mail Search */
157 0x132, 0x16c, 0, 0x165, 0, 0, 0, 0, /* 1008FF18 */
158 /* Calndr PwrDown Back Forward */
159 0x115, 0x15e, 0, 0, 0, 0, 0x16a, 0x169, /* 1008FF20 */
160 /* Stop Refresh Power Wake Sleep */
161 0x168, 0x167, 0x15e, 0x163, 0, 0, 0, 0x15f, /* 1008FF28 */
162 /* Favrts Pause Media MyComp */
163 0x166, 0x122, 0x16d, 0x16b, 0, 0, 0, 0, /* 1008FF30 */
164 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF38 */
165 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF40 */
166 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF48 */
167 /* AppL AppR Calc Close Copy */
168 /* ->F16 */
169 0x109, 0x11e, 0, 0, 0x121, 0, 0x140, 0x67, /* 1008FF50 */
170 /* Cut Docmnts Excel */
171 /* ->F20 */
172 0x6b, 0, 0, 0x105, 0x114, 0, 0, 0, /* 1008FF58 */
173 /* LogOff */
174 0, 0x116, 0, 0, 0, 0, 0, 0, /* 1008FF60 */
175 /* OffcHm Open Paste */
176 /* ->F17 ->F18 */
177 0, 0, 0x13c, 0x68, 0, 0x69, 0, 0, /* 1008FF68 */
178 /* Reply Refresh Save */
179 0, 0, 0x141, 0x167, 0, 0, 0, 0x157, /* 1008FF70 */
180 /* ScrlUp ScrlDn Send Spell TaskPane */
181 0x10b, 0x18b, 0, 0x143, 0x123, 0, 0, 0x13d, /* 1008FF78 */
182 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF80 */
183 /* Word */
184 0, 0x113, 0, 0, 0, 0, 0, 0, /* 1008FF88 */
185 /* MailFwd MyPics MyMusic*/
186 0x142, 0x164, 0x13c, 0, 0, 0, 0, 0, /* 1008FF90 */
187 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FF98 */
188 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFA0 */
189 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFA8 */
190 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFB0 */
191 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFB8 */
192 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFC0 */
193 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFC8 */
194 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFD0 */
195 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFD8 */
196 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFE0 */
197 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFE8 */
198 0, 0, 0, 0, 0, 0, 0, 0, /* 1008FFF0 */
199 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */
200};
201
202/* This list was put together using /usr/include/X11/Sunkeysym.h and
203 comparing the scancodes produced by a Sun type 7 USB keyboard. Note that
204 Sun call F11 and F12 F36 and F37 respectively. */
205static const unsigned sun_key_scan[256] =
206{
207 /* FAGrav, FACirc, FATild, FAAcut, FADiae, FACed */
208 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF00 */
209 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF08 */
210 /* SunF36, SunF37 */
211 0x57, 0x58, 0, 0, 0, 0, 0, 0, /* 1005FF10 */
212 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF18 */
213 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF20 */
214 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF28 */
215 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF30 */
216 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF38 */
217 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF40 */
218 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF48 */
219 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF50 */
220 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF58 */
221 /* SysReq */
222 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF60 */
223 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF68 */
224 /* Props Front Copy Paste Cut Power Vol- Mute */
225 /* ->F13 ->F15 ->F16 ->F18 ->F20 */
226 0x64, 0x66, 0x67, 0x69, 0x6b, 0x15e, 0x12e, 0x120, /* 1005FF70 */
227 /* Vol+ */
228 0x130, 0, 0, 0, 0, 0, 0, 0, /* 1005FF78 */
229 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF80 */
230 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF88 */
231 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF90 */
232 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FF98 */
233 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFA0 */
234 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFA8 */
235 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFB0 */
236 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFB8 */
237 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFC0 */
238 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFC8 */
239 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFD0 */
240 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFD8 */
241 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFE0 */
242 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFE8 */
243 0, 0, 0, 0, 0, 0, 0, 0, /* 1005FFF0 */
244 0, 0, 0, 0, 0, 0, 0, 0 /* 1005FFF8 */
245};
246
247#include "xkbtoscan.h"
248
249#endif /* !___VBox_keyboard_tables_h */
250
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