… | |
… | |
108 | } |
108 | } |
109 | |
109 | |
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 wchar_t *ws) |
114 | { |
114 | { |
115 | wchar_t *wc = rxvt_mbstowcs (trans); |
|
|
116 | char *translation = rxvt_wcstoutf8 (wc); |
115 | char *translation = rxvt_wcstoutf8 (ws); |
117 | free (wc); |
|
|
118 | |
116 | |
119 | if (strncmp (translation, "list", 4) == 0 && translation [4] |
117 | if (strncmp (translation, "list", 4) == 0 && translation [4] |
120 | && strlen (translation) < STRING_MAX) |
118 | && strlen (translation) < STRING_MAX) |
121 | { |
119 | { |
122 | char *prefix = translation + 4; |
120 | char *prefix = translation + 4; |
… | |
… | |
197 | { |
195 | { |
198 | keysym_t *key = keymap [index]; |
196 | keysym_t *key = keymap [index]; |
199 | |
197 | |
200 | if (key->type != keysym_t::BUILTIN) |
198 | if (key->type != keysym_t::BUILTIN) |
201 | { |
199 | { |
202 | wchar_t *wc = rxvt_utf8towcs (key->str); |
200 | wchar_t *ws = rxvt_utf8towcs (key->str); |
203 | char *str = rxvt_wcstombs (wc); |
201 | char *str = rxvt_wcstombs (ws); |
204 | // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) |
202 | // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) |
205 | free (wc); |
203 | free (ws); |
206 | |
204 | |
207 | output_string (term, str); |
205 | output_string (term, str); |
208 | |
206 | |
209 | free (str); |
207 | free (str); |
210 | |
208 | |