diff options
Diffstat (limited to 'input')
-rw-r--r-- | input/cmd.c | 1 | ||||
-rw-r--r-- | input/cmd.h | 1 | ||||
-rw-r--r-- | input/input.c | 5 |
3 files changed, 7 insertions, 0 deletions
diff --git a/input/cmd.c b/input/cmd.c index f0bb53e040..91d171ccaa 100644 --- a/input/cmd.c +++ b/input/cmd.c @@ -511,6 +511,7 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd) } ret->original = bstrdup(ret, cmd->original); ret->key_name = talloc_strdup(ret, ret->key_name); + ret->key_text = talloc_strdup(ret, ret->key_text); if (cmd->def == &mp_cmd_list) { struct mp_cmd *prev = NULL; diff --git a/input/cmd.h b/input/cmd.h index 2d9c922230..83791589ee 100644 --- a/input/cmd.h +++ b/input/cmd.h @@ -114,6 +114,7 @@ typedef struct mp_cmd { const struct mp_cmd_def *def; char *sender; // name of the client API user which sent this char *key_name; // string representation of the key binding + char *key_text; // text if key is a text key } mp_cmd_t; extern const struct mp_cmd_def mp_cmds[]; diff --git a/input/input.c b/input/input.c index 89ef1ace90..89c2571d2b 100644 --- a/input/input.c +++ b/input/input.c @@ -481,6 +481,11 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section, ret->key_name = talloc_steal(ret, mp_input_get_key_combo_name(&code, 1)); MP_TRACE(ictx, "key '%s' -> '%s' in '%s'\n", ret->key_name, cmd->cmd, ret->input_section); + if (MP_KEY_IS_UNICODE(code)) { + bstr text = {0}; + mp_append_utf8_bstr(ret, &text, code); + ret->key_text = text.start; + } ret->is_mouse_button = code & MP_KEY_EMIT_ON_UP; } else { char *key_buf = mp_input_get_key_combo_name(&code, 1); |