diff options
author | metalefty <meta@vmeta.jp> | 2016-11-08 15:12:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-08 15:12:51 +0900 |
commit | d7fd1539512f8d435fbeef3eac4e11ac7b44fd43 (patch) | |
tree | b6ff04516223c6b6541843b5e01a01548eb9d2f0 | |
parent | 8da1829981b9a34bb4fbb92e3f07a1d77ad19a66 (diff) | |
parent | 5725200e8275315d08acb317e523cbfca6ac7c40 (diff) | |
download | xrdp-proprietary-d7fd1539512f8d435fbeef3eac4e11ac7b44fd43.tar.gz xrdp-proprietary-d7fd1539512f8d435fbeef3eac4e11ac7b44fd43.zip |
Merge pull request #418 from metalefty/keymap-fallback-lower-16bit
Use km-0000yyyy.ini if km-xxxxyyyy.ini doen't exist
-rw-r--r-- | xrdp/lang.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xrdp/lang.c b/xrdp/lang.c index ae577596..1dede6f6 100644 --- a/xrdp/lang.c +++ b/xrdp/lang.c @@ -226,22 +226,34 @@ int APP_CC get_keymaps(int keylayout, struct xrdp_keymap *keymap) { int fd; + int basic_key_layout = keylayout & 0x0000ffff; char *filename; struct xrdp_keymap *lkeymap; filename = (char *)g_malloc(256, 0); - /* check if there is a keymap file */ + + /* check if there is a keymap file e.g. km-e00100411.ini */ g_snprintf(filename, 255, "%s/km-%08x.ini", XRDP_CFG_PATH, keylayout); - /* if the file does not exist, try again with 'en-us' as fallback */ + /* if the file does not exist, use only lower 16 bits instead */ + if (!g_file_exist(filename)) + { + log_message(LOG_LEVEL_INFO, "Cannot find keymap file %s", filename); + /* e.g. km-00000411.ini */ + g_snprintf(filename, 255, "%s/km-%08x.ini", XRDP_CFG_PATH, basic_key_layout); + } + + /* finally, use 'en-us' */ if (!g_file_exist(filename)) { + log_message(LOG_LEVEL_INFO, "Cannot find keymap file %s", filename); g_snprintf(filename, 255, "%s/km-00000409.ini", XRDP_CFG_PATH); } if (g_file_exist(filename)) { fd = g_file_open(filename); + log_message(LOG_LEVEL_INFO, "Loading keymap file %s", filename); if (fd != -1) { |