diff options
author | Laxmikant Rashinkar <lk@Ubuntu-12.04-32bit> | 2014-10-11 14:49:46 -0700 |
---|---|---|
committer | Laxmikant Rashinkar <lk@Ubuntu-12.04-32bit> | 2014-10-11 14:49:46 -0700 |
commit | 8c316b46b8d6b1cb3cf32165daf817030aac1a47 (patch) | |
tree | 089c5741cb2a914501e5ab28898a5c71c4c4103b /xorg/X11R7.6/rdp/rdpinput.c | |
parent | 5b6b74577fda4bbcd0a02a585d783c59d68953da (diff) | |
parent | bc7a6b9bc66afe4adf7c232c94e41694319d4155 (diff) | |
download | xrdp-proprietary-8c316b46b8d6b1cb3cf32165daf817030aac1a47.tar.gz xrdp-proprietary-8c316b46b8d6b1cb3cf32165daf817030aac1a47.zip |
Merge branch 'devel'
Diffstat (limited to 'xorg/X11R7.6/rdp/rdpinput.c')
-rw-r--r-- | xorg/X11R7.6/rdp/rdpinput.c | 79 |
1 files changed, 37 insertions, 42 deletions
diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c index 7fb20379..ef0bb929 100644 --- a/xorg/X11R7.6/rdp/rdpinput.c +++ b/xorg/X11R7.6/rdp/rdpinput.c @@ -282,7 +282,7 @@ rdpChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) /******************************************************************************/ int -rdpLoadLayout(int keylayout) +rdpLoadLayout(struct xrdp_client_info *client_info) { XkbRMLVOSet set; XkbSrvInfoPtr xkbi; @@ -292,8 +292,10 @@ rdpLoadLayout(int keylayout) KeyCode first_key; CARD8 num_keys; - LLOGLN(0, ("rdpLoadLayout: keylayout 0x%8.8x display %s", - keylayout, display)); + int keylayout = client_info->keylayout; + + LLOGLN(0, ("rdpLoadLayout: keylayout 0x%8.8x variant %s display %s", + keylayout, client_info->variant, display)); memset(&set, 0, sizeof(set)); if (g_use_evdev) { @@ -303,42 +305,26 @@ rdpLoadLayout(int keylayout) { set.rules = "base"; } + set.model = "pc104"; set.layout = "us"; - switch (keylayout) - { - case 0x00000407: /* German */ - set.layout = "de"; - break; - case 0x00000409: /* US */ - set.layout = "us"; - break; - case 0x0000040C: /* French */ - set.layout = "fr"; - break; - case 0x00000410: /* Italian */ - set.layout = "it"; - break; - case 0x00000416: /* Portuguese (Brazilian ABNT) */ - set.model = "abnt2"; - set.layout = "br"; - break; - case 0x00000419: /* Russian */ - set.layout = "ru"; - break; - case 0x0000041D: /* Swedish */ - set.layout = "se"; - break; - case 0x00000816: /* Portuguese */ - set.layout = "pt"; - break; - default: - LLOGLN(0, ("rdpLoadLayout: unknown keylayout 0x%8.8x", keylayout)); - break; - } set.variant = ""; set.options = ""; + if (strlen(client_info->model) > 0) + { + set.model = client_info->model; + } + if (strlen(client_info->variant) > 0) + { + set.variant = client_info->variant; + } + if (strlen(client_info->layout) > 0) + { + set.layout = client_info->layout; + } + + retry: /* free some stuff so we can call InitKeyboardDeviceStruct again */ xkbi = g_keyboard->key->xkbInfo; xkb = xkbi->desc; @@ -355,21 +341,30 @@ rdpLoadLayout(int keylayout) rdpChangeKeyboardControl)) { LLOGLN(0, ("rdpLoadLayout: InitKeyboardDeviceStruct failed")); + return 1; } /* notify the X11 clients eg. X_ChangeKeyboardMapping */ keySyms = XkbGetCoreMap(g_keyboard); - first_key = keySyms->minKeyCode; - num_keys = (keySyms->maxKeyCode - keySyms->minKeyCode) + 1; - XkbApplyMappingChange(g_keyboard, keySyms, first_key, num_keys, - NULL, serverClient); - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (keySyms) { - if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) + first_key = keySyms->minKeyCode; + num_keys = (keySyms->maxKeyCode - keySyms->minKeyCode) + 1; + XkbApplyMappingChange(g_keyboard, keySyms, first_key, num_keys, + NULL, serverClient); + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { - XkbApplyMappingChange(pDev, keySyms, first_key, num_keys, - NULL, serverClient); + if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) + { + XkbApplyMappingChange(pDev, keySyms, first_key, num_keys, + NULL, serverClient); + } } + } else + { + /* sometimes, variant doesn't support all layouts */ + set.variant = ""; + goto retry; } return 0; |