summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/Common
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Frontends/Common
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Frontends/Common')
-rw-r--r--src/VBox/Frontends/Common/VBoxKeyboard/Makefile2
-rw-r--r--src/VBox/Frontends/Common/VBoxKeyboard/keyboard-layouts.h9
-rw-r--r--src/VBox/Frontends/Common/VBoxKeyboard/keyboard-list.h1
-rw-r--r--src/VBox/Frontends/Common/VBoxKeyboard/keyboard-types.h19
-rw-r--r--src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c22
-rw-r--r--src/VBox/Frontends/Common/VBoxKeyboard/xkbtoscan.h8
6 files changed, 58 insertions, 3 deletions
diff --git a/src/VBox/Frontends/Common/VBoxKeyboard/Makefile b/src/VBox/Frontends/Common/VBoxKeyboard/Makefile
index 0227c0f3..492eab4c 100644
--- a/src/VBox/Frontends/Common/VBoxKeyboard/Makefile
+++ b/src/VBox/Frontends/Common/VBoxKeyboard/Makefile
@@ -6,7 +6,7 @@
# Note that for reasons of convenience, VirtualBox builds this library
# from inside its own build system rather than using this file.
-# Copyright (C) 2007-2008 Oracle Corporation
+# Copyright (C) 2007-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-layouts.h b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-layouts.h
index 593eee71..04d316c1 100644
--- a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-layouts.h
+++ b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-layouts.h
@@ -122,6 +122,15 @@ static const char main_key_us_rus[MAIN_LEN][2] =
"\xda\xfa","\xd8\xf8","\xc3\xe3","\xd6\xf6","\xc2\xe2","\xce\xee","\xcd\xed",",<",".>","/?","<>","\x0\x0","\x0\x0"
};
+/* U.S. English, Colemak */
+static const char main_key_us_col[MAIN_LEN][2] =
+{
+"`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+"qQ","wW","fF","pP","gG","jJ","lL","uU","yY",";:","[{","]}",
+"aA","rR","sS","tT","dD","hH","nN","eE","iI","oO","'\"","\\|",
+"zZ","xX","cC","vV","bB","kK","mM",",<",".>","/?","-_","\x0\x0","\x0\x0"
+};
+
/* Afghanistan */
static const char main_key_af[MAIN_LEN][2] =
{
diff --git a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-list.h b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-list.h
index 71f317f4..9f5f6d97 100644
--- a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-list.h
+++ b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-list.h
@@ -48,6 +48,7 @@
{"U.S. English, Right handed Dvorak", &main_key_us_dvorak_r},
{"U.S. English, Classic Dvorak", &main_key_us_dvorak_classic},
{"U.S. English, Russian phonetic", &main_key_us_rus},
+ {"U.S. English, Colemak", &main_key_us_col},
{"Afghanistan", &main_key_af},
{"Afghanistan, Pashto", &main_key_af_ps},
{"Afghanistan, Southern Uzbek", &main_key_af_uz},
diff --git a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-types.h b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-types.h
index f95ace72..f4f48e64 100644
--- a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-types.h
+++ b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard-types.h
@@ -76,6 +76,8 @@ static keyboard_type main_keyboard_type_list[] = {
0x64, 0x66, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a },
{ "evdev", 0x25, 0x32, 0x42, 0x17, 0x9, 0x24, 0x6f, 0x74,
0x71, 0x72, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a },
+ { "XQuartz", 0x43, 0x40, 0x41, 0x38, 0x3d, 0x2c, 0x86, 0x85,
+ 0x83, 0x84, 0x82, 0x80, 0x6b, 0x7e, 0x68, 0x69, 0x6a, 0x6c },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } /* Sentinel */
};
@@ -114,6 +116,23 @@ unsigned main_keyboard_type_scans[][256] = {
0x0, 0x165, 0x0, 0x0, 0x0, 0x165, 0x166, 0x167, 0x168, 0x169, 0x16a, 0x16b, 0x16c, 0x16d, 0x0, 0x143,
0x141, 0x0, 0x157, 0x105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
},
+ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1e, 0x1f, 0x20, 0x21, 0x23, 0x22, 0x2c, 0x2d,
+ 0x2e, 0x2f, 0x29, 0x30, 0x10, 0x11, 0x12, 0x13, 0x15, 0x14, 0x2, 0x3, 0x4, 0x5, 0x7, 0x6,
+ 0xd, 0xa, 0x8, 0xc, 0x9, 0xb, 0x1b, 0x18, 0x16, 0x1a, 0x17, 0x19, 0x1c, 0x26, 0x24, 0x28,
+ 0x25, 0x27, 0x2b, 0x33, 0x35, 0x31, 0x32, 0x34, 0xf, 0x39, 0x56, 0xe, 0x0, 0x1, 0x0, 0x15b,
+ 0x2a, 0x3a, 0x38, 0x1d, 0x36, 0x138, 0x11d, 0x15c, 0x0, 0x0, 0x0, 0x37, 0x0, 0x4e, 0x0, 0x1,
+ 0x0, 0x0, 0x0, 0x135, 0x11c, 0x0, 0x4a, 0x0, 0x0, 0x0, 0x52, 0x4f, 0x50, 0x51, 0x4b, 0x4c,
+ 0x4d, 0x47, 0x0, 0x48, 0x49, 0x0, 0x0, 0x0, 0x3f, 0x40, 0x41, 0x3d, 0x42, 0x43, 0x0, 0x57,
+ 0x0, 0x64, 0x0, 0x65, 0x0, 0x44, 0x0, 0x58, 0x0, 0x66, 0x6e, 0x147, 0x149, 0x153, 0x3e, 0x14f,
+ 0x3c, 0x151, 0x3b, 0x14b, 0x14d, 0x150, 0x148, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+ },
{ 0 } /* Sentinel */
};
diff --git a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c
index 835abe29..f67ccfc8 100644
--- a/src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c
+++ b/src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c
@@ -54,6 +54,10 @@
#include <VBox/VBoxKeyboard.h>
+/* VBoxKeyboard uses the deprecated XKeycodeToKeysym(3) API, but uses it safely.
+ */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
#define KEYC2SCAN_SIZE 256
/**
@@ -547,13 +551,17 @@ X11DRV_InitKeyboardByType(Display *display)
/**
* Checks for the XKB extension, and if it is found initialises the X11 keycode
- * to XT scan code mapping by looking at the XKB names for each keycode.
+ * to XT scan code mapping by looking at the XKB names for each keycode. As it
+ * turns out that XKB can return an empty list we make sure that the list holds
+ * enough data to be useful to us.
*/
static unsigned
X11DRV_InitKeyboardByXkb(Display *pDisplay)
{
int major = XkbMajorVersion, minor = XkbMinorVersion;
XkbDescPtr pKBDesc;
+ unsigned cFound = 0;
+
if (!XkbLibraryVersion(&major, &minor))
return 0;
if (!XkbQueryExtension(pDisplay, NULL, NULL, &major, &minor, NULL))
@@ -574,12 +582,13 @@ X11DRV_InitKeyboardByXkb(Display *pDisplay)
XKB_NAME_SIZE))
{
keyc2scan[i] = xkbMap[j].uScan;
+ ++cFound;
break;
}
}
XkbFreeNames(pKBDesc, XkbKeyNamesMask, True);
XkbFreeKeyboard(pKBDesc, XkbAllComponentsMask, True);
- return 1;
+ return cFound >= 45 ? 1 : 0;
}
/**
@@ -632,6 +641,15 @@ unsigned X11DRV_InitKeyboard(Display *display, unsigned *byLayoutOK,
if (byXkbOK)
*byXkbOK = byXkb;
+ /* Fall back to the one which did work. */
+ if (!byXkb)
+ {
+ if (byType)
+ X11DRV_InitKeyboardByType(display);
+ else
+ X11DRV_InitKeyboardByLayout(display);
+ }
+
/* Remap keycodes after initialization. Remapping stops after an
identity mapping is seen */
if (remapScancodes != NULL)
diff --git a/src/VBox/Frontends/Common/VBoxKeyboard/xkbtoscan.h b/src/VBox/Frontends/Common/VBoxKeyboard/xkbtoscan.h
index f9f346b3..04d515ad 100644
--- a/src/VBox/Frontends/Common/VBoxKeyboard/xkbtoscan.h
+++ b/src/VBox/Frontends/Common/VBoxKeyboard/xkbtoscan.h
@@ -87,6 +87,7 @@ struct
{ "AC09", 0x26 },
{ "AC10", 0x27 },
{ "AC11", 0x28 },
+ { "AC12", 0x2b },
{ "TLDE", 0x29 },
/* { "LFSH", 0x2a }, */
{ "BKSL", 0x2b },
@@ -130,6 +131,7 @@ struct
{ "KP3", 0x51 },
{ "KP0", 0x52 },
{ "KPDL", 0x53 },
+ { "KPPT", 0x7e },
{ "LVL3", 0x138 }, */
{ "LSGT", 0x56 },
/* { "FK11", 0x57 },
@@ -140,12 +142,14 @@ struct
{ "HENK", 0x79 },
{ "HKTG", 0x70 },
{ "MUHE", 0x7b },
+ { "HZTG", 0x29 },
{ "JPCM", 0x0 },
{ "KPEN", 0x11c },
{ "RCTL", 0x11d },
{ "KPDV", 0x135 },
{ "PRSC", 0x137 },
{ "RALT", 0x138 },
+ { "ALGR", 0x138 },
{ "LNFD", 0x0 },
{ "HOME", 0x147 },
{ "UP", 0x148 },
@@ -167,12 +171,16 @@ struct
{ "PAUS", 0x45 },
{ "I128", 0x0 },
{ "I129", 0x7e },
+ { "KPPT", 0x7e },
{ "HNGL", 0xf2 },
{ "HJCV", 0xf1 }, */
{ "AE13", 0x7d },
/* { "LWIN", 0x15b },
+ { "LMTA", 0x15b },
{ "RWIN", 0x15c },
+ { "RMTA", 0x15c },
{ "COMP", 0x15d },
+ { "MENU", 0x15d },
{ "STOP", 0x168 },
{ "AGAI", 0x105 },
{ "PROP", 0x106 },