Merge pull request #418 from metalefty/keymap-fallback-lower-16bit

Use km-0000yyyy.ini if km-xxxxyyyy.ini doen't exist
master
metalefty 8 years ago committed by GitHub
commit d7fd153951

@ -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)
{

Loading…
Cancel
Save