… | |
… | |
110 | // a wrapper for register_translation that converts the input string |
110 | // a wrapper for register_translation that converts the input string |
111 | // to utf-8 and expands 'list' syntax. |
111 | // to utf-8 and expands 'list' syntax. |
112 | void |
112 | void |
113 | keyboard_manager::register_user_translation (KeySym keysym, unsigned int state, const char *trans) |
113 | keyboard_manager::register_user_translation (KeySym keysym, unsigned int state, const char *trans) |
114 | { |
114 | { |
115 | wchar_t *wc = rxvt_mbstowcs (trans); |
115 | wchar_t *ws = rxvt_mbstowcs (trans); |
116 | char *translation = rxvt_wcstoutf8 (wc); |
116 | char *translation = rxvt_wcstoutf8 (ws); |
117 | free (wc); |
117 | free (ws); |
118 | |
118 | |
119 | if (strncmp (translation, "list", 4) == 0 && translation [4] |
119 | if (strncmp (translation, "list", 4) == 0 && translation [4] |
120 | && strlen (translation) < STRING_MAX) |
120 | && strlen (translation) < STRING_MAX) |
121 | { |
121 | { |
122 | char *prefix = translation + 4; |
122 | char *prefix = translation + 4; |
… | |
… | |
197 | { |
197 | { |
198 | keysym_t *key = keymap [index]; |
198 | keysym_t *key = keymap [index]; |
199 | |
199 | |
200 | if (key->type != keysym_t::BUILTIN) |
200 | if (key->type != keysym_t::BUILTIN) |
201 | { |
201 | { |
202 | wchar_t *wc = rxvt_utf8towcs (key->str); |
202 | wchar_t *ws = rxvt_utf8towcs (key->str); |
203 | char *str = rxvt_wcstombs (wc); |
203 | char *str = rxvt_wcstombs (ws); |
204 | // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) |
204 | // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) |
205 | free (wc); |
205 | free (ws); |
206 | |
206 | |
207 | output_string (term, str); |
207 | output_string (term, str); |
208 | |
208 | |
209 | free (str); |
209 | free (str); |
210 | |
210 | |