aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winconfig.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-20 14:23:37 +0000
committermarha <marha@users.sourceforge.net>2011-02-20 14:23:37 +0000
commit684eb992146cad24b690073f33b909f47150b841 (patch)
tree7bc62d6f06c5e8a8114b56fa78485cb7ec08f26b /xorg-server/hw/xwin/winconfig.c
parent53810445215dc45ae303bc89feb6e0aaf04aa6fa (diff)
parent8a191c08ddda2e66fa26f148d6c21959bb08f923 (diff)
downloadvcxsrv-684eb992146cad24b690073f33b909f47150b841.tar.gz
vcxsrv-684eb992146cad24b690073f33b909f47150b841.tar.bz2
vcxsrv-684eb992146cad24b690073f33b909f47150b841.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/hw/xwin/winconfig.c')
-rw-r--r--xorg-server/hw/xwin/winconfig.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c
index f654d13da..1325e77a6 100644
--- a/xorg-server/hw/xwin/winconfig.c
+++ b/xorg-server/hw/xwin/winconfig.c
@@ -239,6 +239,7 @@ Bool
winConfigKeyboard (DeviceIntPtr pDevice)
{
char layoutName[KL_NAMELENGTH];
+ unsigned char layoutFriendlyName[256];
static unsigned int layoutNum = 0;
int keyboardType;
#ifdef XWIN_XF86CONFIG
@@ -298,11 +299,32 @@ winConfigKeyboard (DeviceIntPtr pDevice)
if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
winDebug("Loading US keyboard layout.\n");
else
- ErrorF ("LoadKeyboardLaout failed.\n");
+ ErrorF ("LoadKeyboardLayout failed.\n");
}
}
- winDebug ("winConfigKeyboard - Layout: \"%s\" (%08x) \n",
- layoutName, layoutNum);
+
+ /* Discover the friendly name of the current layout */
+ {
+ HKEY regkey = NULL;
+ const char regtempl[] = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
+ char *regpath;
+ DWORD namesize = sizeof(layoutFriendlyName);
+
+ regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
+ strcpy(regpath, regtempl);
+ strcat(regpath, layoutName);
+
+ if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey))
+ RegQueryValueEx(regkey, "Layout Text", 0, NULL, layoutFriendlyName, &namesize);
+
+ /* Close registry key */
+ if (regkey)
+ RegCloseKey (regkey);
+ free(regpath);
+ }
+
+ winDebug ("Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n",
+ layoutName, layoutNum, layoutFriendlyName, keyboardType);
for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
{
@@ -310,44 +332,35 @@ winConfigKeyboard (DeviceIntPtr pDevice)
continue;
if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
continue;
-
+
bfound = TRUE;
- winDebug ("Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
- pLayout->layoutname, pLayout->winlayout, keyboardType);
-
+ winDebug (
+ "Found matching XKB configuration \"%s\"\n",
+ pLayout->layoutname);
+
+ winDebug(
+ "Model = \"%s\" Layout = \"%s\""
+ " Variant = \"%s\" Options = \"%s\"\n",
+ pLayout->xkbmodel ? pLayout->xkbmodel : "none",
+ pLayout->xkblayout ? pLayout->xkblayout : "none",
+ pLayout->xkbvariant ? pLayout->xkbvariant : "none",
+ pLayout->xkboptions ? pLayout->xkboptions : "none");
+
g_winInfo.xkb.model = pLayout->xkbmodel;
g_winInfo.xkb.layout = pLayout->xkblayout;
g_winInfo.xkb.variant = pLayout->xkbvariant;
- g_winInfo.xkb.options = pLayout->xkboptions;
+ g_winInfo.xkb.options = pLayout->xkboptions;
+
+
break;
}
-
+
if (!bfound)
{
- HKEY regkey = NULL;
- const char regtempl[] =
- "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
- char *regpath;
- unsigned char lname[256];
- DWORD namesize = sizeof(lname);
-
- regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
- strcpy(regpath, regtempl);
- strcat(regpath, layoutName);
-
- if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey) &&
- !RegQueryValueEx(regkey, "Layout Text", 0, NULL, lname, &namesize))
- {
- ErrorF ("Keyboardlayout \"%s\" (%s) is unknown\n", lname, layoutName);
- }
-
- /* Close registry key */
- if (regkey)
- RegCloseKey (regkey);
- free(regpath);
+ ErrorF ("Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName);
}
- }
-
+ }
+
/* parse the configuration */
#ifdef XWIN_XF86CONFIG
if (g_cmdline.keyboard)