From 6515df13337a7d3e11cc636cc004acf6f03b6c1d Mon Sep 17 00:00:00 2001 From: Hideyuki Nagase Date: Wed, 27 Apr 2022 14:33:17 -0500 Subject: [PATCH] rdp: Support using Japanese layouts with US keyboards When RDP indicates that a Japanese keyboard layout is used without a Japanese 106/109 keyboard (keyboard type 7), use the "us" layout, since the "jp" layout in xkb expects the Japanese 106/109 keyboard layout. Co-authored-by: Steve Pronovost Co-authored-by: Brenton DeGeer Signed-off-by: Hideyuki Nagase Signed-off-by: Steve Pronovost Signed-off-by: Brenton DeGeer --- libweston/backend-rdp/rdp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libweston/backend-rdp/rdp.c b/libweston/backend-rdp/rdp.c index 7ce0c719..bde4653f 100644 --- a/libweston/backend-rdp/rdp.c +++ b/libweston/backend-rdp/rdp.c @@ -849,7 +849,15 @@ convert_rdp_keyboard_to_xkb_rule_names(UINT32 KeyboardType, xkbRuleNames->variant = "kr104"; /* kr(ralt_hangul)/kr(rctrl_hanja) */ else if (KeyboardSubType == 6) /* PC/AT 103 Enhanced Korean Keyboard */ xkbRuleNames->variant = "kr106"; /* kr(hw_keys) */ + } else if (KeyboardType != KBD_TYPE_JAPANESE && ((KeyboardLayout & 0xFFFF) == 0x411)) { + /* when Japanese keyboard layout is used without a Japanese 106/109 + * keyboard (keyboard type 7), use the "us" layout, since the "jp" + * layout in xkb expects the Japanese 106/109 keyboard layout. + */ + xkbRuleNames->layout = "us"; + xkbRuleNames->variant = 0; } + weston_log("%s: matching model=%s layout=%s variant=%s options=%s\n", __func__, xkbRuleNames->model, xkbRuleNames->layout, xkbRuleNames->variant, xkbRuleNames->options);