diff --git a/libweston/backend-rdp/rdp.c b/libweston/backend-rdp/rdp.c index 300e5203e..09debbae9 100644 --- a/libweston/backend-rdp/rdp.c +++ b/libweston/backend-rdp/rdp.c @@ -1109,7 +1109,7 @@ struct rdp_to_xkb_keyboard_layout rdp_keyboards[] = { {KBD_IRISH, 0, 0}, {KBD_BOSNIAN_CYRILLIC, "ba", "us"}, {KBD_UNITED_STATES_DVORAK, "us", "dvorak"}, - {KBD_PORTUGUESE_BRAZILIAN_ABNT2, "br", "nativo"}, + {KBD_PORTUGUESE_BRAZILIAN_ABNT2, "br", "abnt2"}, {KBD_CANADIAN_MULTILINGUAL_STANDARD, "ca", "multix"}, {KBD_GAELIC, "ie", "CloGaelach"}, @@ -1147,6 +1147,7 @@ convert_rdp_keyboard_to_xkb_rule_names( break; } } + /* Korean keyboard support (KeyboardType 8, LangID 0x412) */ if (KeyboardType == 8 && ((KeyboardLayout & 0xFFFF) == 0x412)) { /* TODO: PC/AT 101 Enhanced Korean Keyboard (Type B) and (Type C) is not supported yet @@ -1160,8 +1161,20 @@ convert_rdp_keyboard_to_xkb_rule_names( else if (KeyboardSubType == 6) // PC/AT 103 Enhanced Korean Keyboard xkbRuleNames->variant = "kr106"; // kr(hw_keys) } - weston_log("%s: matching layout=%s variant=%s options=%s\n", __FUNCTION__, - xkbRuleNames->layout, xkbRuleNames->variant, xkbRuleNames->options); + /* Japanese keyboard layout is used with other than Japanese 106/109 keyboard */ + else if (KeyboardType != 7 && ((KeyboardLayout & 0xFFFF) == 0x411)) { + /* when Japanese keyboard layout is used other than Japanese 106/109 keyboard (keyboard type 7), + use "us" layout, since the "jp" layout in xkb expects Japanese 106/109 keyboard layout. */ + xkbRuleNames->layout = "us"; + xkbRuleNames->variant = 0; + } + /* Brazilian ABNT2 keyboard */ + else if (KeyboardLayout == KBD_PORTUGUESE_BRAZILIAN_ABNT2) { + xkbRuleNames->model = "pc105"; + } + + weston_log("%s: matching model=%s layout=%s variant=%s options=%s\n", __FUNCTION__, + xkbRuleNames->model, xkbRuleNames->layout, xkbRuleNames->variant, xkbRuleNames->options); } static BOOL diff --git a/libweston/backend-rdp/rdprail.c b/libweston/backend-rdp/rdprail.c index f73c67122..feffb8dbf 100644 --- a/libweston/backend-rdp/rdprail.c +++ b/libweston/backend-rdp/rdprail.c @@ -751,8 +751,8 @@ languageGuid_to_string(const GUID *guid) } lang_GUID; static const lang_GUID c_GUID_NULL = GUID_NULL; - static const lang_GUID c_GUID_MSIME_JPN = GUID_MSIME_JPN; - static const lang_GUID c_GUID_MSIME_KOR = GUID_MSIME_KOR; + static const lang_GUID c_GUID_JPNIME = GUID_MSIME_JPN; + static const lang_GUID c_GUID_KORIME = GUID_MSIME_KOR; static const lang_GUID c_GUID_CHSIME = GUID_CHSIME; static const lang_GUID c_GUID_CHTIME = GUID_CHTIME; static const lang_GUID c_GUID_PROFILE_NEWPHONETIC = GUID_PROFILE_NEWPHONETIC; @@ -767,10 +767,10 @@ languageGuid_to_string(const GUID *guid) RPC_STATUS rpc_status; if (UuidEqual(guid, (GUID *)&c_GUID_NULL, &rpc_status)) return "GUID_NULL"; - else if (UuidEqual(guid, (GUID *)&c_GUID_MSIME_JPN, &rpc_status)) - return "GUID_MSIME_JPN"; - else if (UuidEqual(guid, (GUID *)&c_GUID_MSIME_KOR, &rpc_status)) - return "GUID_MSIME_KOR"; + else if (UuidEqual(guid, (GUID *)&c_GUID_JPNIME, &rpc_status)) + return "GUID_JPNIME"; + else if (UuidEqual(guid, (GUID *)&c_GUID_KORIME, &rpc_status)) + return "GUID_KORIME"; else if (UuidEqual(guid, (GUID *)&c_GUID_CHSIME, &rpc_status)) return "GUID_CHSIME"; else if (UuidEqual(guid, (GUID *)&c_GUID_CHTIME, &rpc_status)) @@ -804,6 +804,9 @@ rail_client_LanguageImeInfo_callback(int fd, uint32_t mask, void *arg) rdpSettings *settings = client->settings; RdpPeerContext *peerCtx = (RdpPeerContext *)client->context; struct rdp_backend *b = peerCtx->rdpBackend; + UINT32 new_keyboard_layout = 0; + struct xkb_keymap *keymap = NULL; + struct xkb_rule_names xkbRuleNames; char *s; ASSERT_COMPOSITOR_THREAD(b); @@ -829,12 +832,49 @@ rail_client_LanguageImeInfo_callback(int fd, uint32_t mask, void *arg) rdp_debug(b, "Client: LanguageImeInfo: KeyboardLayout: 0x%x\n", languageImeInfo->KeyboardLayout); if (languageImeInfo->ProfileType == TF_PROFILETYPE_KEYBOARDLAYOUT) { - struct xkb_rule_names xkbRuleNames; - struct xkb_keymap *keymap = NULL; - settings->KeyboardLayout = languageImeInfo->KeyboardLayout; + new_keyboard_layout = languageImeInfo->KeyboardLayout; + } else if (languageImeInfo->ProfileType == TF_PROFILETYPE_INPUTPROCESSOR) { + typedef struct _lang_GUID + { + UINT32 Data1; + UINT16 Data2; + UINT16 Data3; + BYTE Data4_0; + BYTE Data4_1; + BYTE Data4_2; + BYTE Data4_3; + BYTE Data4_4; + BYTE Data4_5; + BYTE Data4_6; + BYTE Data4_7; + } lang_GUID; + + static const lang_GUID c_GUID_JPNIME = GUID_MSIME_JPN; + static const lang_GUID c_GUID_KORIME = GUID_MSIME_KOR; + static const lang_GUID c_GUID_CHSIME = GUID_CHSIME; + static const lang_GUID c_GUID_CHTIME = GUID_CHTIME; + + RPC_STATUS rpc_status; + if (UuidEqual(&languageImeInfo->LanguageProfileCLSID, + (GUID *)&c_GUID_JPNIME, &rpc_status)) + new_keyboard_layout = KBD_JAPANESE; + else if (UuidEqual(&languageImeInfo->LanguageProfileCLSID, + (GUID *)&c_GUID_KORIME, &rpc_status)) + new_keyboard_layout = KBD_KOREAN; + else if (UuidEqual(&languageImeInfo->LanguageProfileCLSID, + (GUID *)&c_GUID_CHSIME, &rpc_status)) + new_keyboard_layout = KBD_CHINESE_SIMPLIFIED_US; + else if (UuidEqual(&languageImeInfo->LanguageProfileCLSID, + (GUID *)&c_GUID_CHTIME, &rpc_status)) + new_keyboard_layout = KBD_CHINESE_TRADITIONAL_US; + else + new_keyboard_layout = KBD_US; + } + + if (new_keyboard_layout && (new_keyboard_layout != settings->KeyboardLayout)) { convert_rdp_keyboard_to_xkb_rule_names(settings->KeyboardType, settings->KeyboardSubType, - settings->KeyboardLayout, + new_keyboard_layout, &xkbRuleNames); if (xkbRuleNames.layout) { keymap = xkb_keymap_new_from_names(b->compositor->xkb_context, @@ -842,11 +882,12 @@ rail_client_LanguageImeInfo_callback(int fd, uint32_t mask, void *arg) if (keymap) { weston_seat_update_keymap(peerCtx->item.seat, keymap); xkb_keymap_unref(keymap); + settings->KeyboardLayout = new_keyboard_layout; } } if (!keymap) { rdp_debug_error(b, "%s: Failed to switch to kbd_layout:0x%x kbd_type:0x%x kbd_subType:0x%x\n", - __func__, settings->KeyboardLayout, settings->KeyboardType, settings->KeyboardSubType); + __func__, new_keyboard_layout, settings->KeyboardType, settings->KeyboardSubType); } }