ref: 4fec34471f0587c0eaa62e0cc580b7bfc6457f61
parent: 8df8a86e40b16f25f05ef2705f09c2be8f551d22
author: Jacob Moody <moody@posixcafe.org>
date: Fri Oct 7 10:00:18 EDT 2022
gui-wl: correct kb ctl handling We were manually converting ^X sequences into control characters ourselves. However simply emitting ctl correctly allows this to be done by kbdfs. This also corrects right alt to altgr and correctly interprets Japanese keysyms in to their 'standard' plan9 control characters.
--- a/gui-wl/wl-cb.c
+++ b/gui-wl/wl-cb.c
@@ -220,8 +220,14 @@
case XKB_KEY_Page_Down:
utf32 = Kpgdown;
break;
- case XKB_KEY_Alt_L:
+ case XKB_KEY_Control_L:
+ case XKB_KEY_Control_R:
+ utf32 = Kctl;
+ break;
case XKB_KEY_Alt_R:
+ utf32 = Kaltgr;
+ break;
+ case XKB_KEY_Alt_L:
utf32 = Kalt;
break;
case XKB_KEY_Shift_L:
@@ -273,6 +279,27 @@
case XKB_KEY_XF86AudioMute:
utf32 = Kmute;
break;
+
+ /* Japanese layout; see /sys/lib/kbmap/jp */
+ case XKB_KEY_Muhenkan:
+ utf32 = 0x0c; // ^l
+ break;
+ case XKB_KEY_Henkan:
+ utf32 = 0x1c; // ^\\
+ break;
+ case XKB_KEY_Hiragana:
+ utf32 = 0x0e; // ^n
+ break;
+ case XKB_KEY_Katakana:
+ utf32 = 0x0b; // ^k
+ break;
+ case XKB_KEY_Hiragana_Katakana:
+ /* board may not maintain kana state */
+ if(xkb_state_mod_name_is_active(wl->xkb_state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE) > 0)
+ utf32 = 0x0b;
+ else
+ utf32 = 0x0e;
+ break;
default:
utf32 = xkb_keysym_to_utf32(keysym);
break;
@@ -298,13 +325,6 @@
}
}
repeat = state && utf32 != Kctl && utf32 != Kshift && utf32 != Kalt && utf32 != Kmod4;
- if(xkb_state_mod_name_is_active(wl->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0){
- if(utf32 == '\\')
- utf32 = 0x1c;
- else if(utf32 >= 'a' && utf32 <= '~')
- utf32 -= ('a' - 1);
- }
-
kbdkey(utf32, state);
qlock(&repeatstate.lk);
repeatstate.active = repeat;