summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
Diffstat (limited to 'input')
-rw-r--r--input/cmd_parse.c1
-rw-r--r--input/input.c5
-rw-r--r--input/input.h1
3 files changed, 4 insertions, 3 deletions
diff --git a/input/cmd_parse.c b/input/cmd_parse.c
index ba35cd5e1c..c2c3270e97 100644
--- a/input/cmd_parse.c
+++ b/input/cmd_parse.c
@@ -417,6 +417,7 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd)
m_option_copy(ret->args[i].type, &ret->args[i].v, &cmd->args[i].v);
}
ret->original = bstrdup(ret, cmd->original);
+ ret->key_name = talloc_strdup(ret, ret->key_name);
if (cmd->id == MP_CMD_COMMAND_LIST) {
struct mp_cmd *prev = NULL;
diff --git a/input/input.c b/input/input.c
index e1dfe2e616..58907ccd50 100644
--- a/input/input.c
+++ b/input/input.c
@@ -460,11 +460,10 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section,
mp_cmd_t *ret = mp_input_parse_cmd(ictx, bstr0(cmd->cmd), cmd->location);
if (ret) {
ret->input_section = cmd->owner->section;
+ ret->key_name = talloc_steal(ret, mp_input_get_key_combo_name(&code, 1));
if (mp_msg_test(ictx->log, MSGL_DEBUG)) {
- char *keyname = mp_input_get_key_combo_name(&code, 1);
MP_DBG(ictx, "key '%s' -> '%s' in '%s'\n",
- keyname, cmd->cmd, ret->input_section);
- talloc_free(keyname);
+ ret->key_name, cmd->cmd, ret->input_section);
}
ret->is_mouse_button = code & MP_KEY_EMIT_ON_UP;
} else {
diff --git a/input/input.h b/input/input.h
index 2b2299d5cc..6462555326 100644
--- a/input/input.h
+++ b/input/input.h
@@ -86,6 +86,7 @@ typedef struct mp_cmd {
double scale; // for scaling numeric arguments
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
} mp_cmd_t;
struct mp_input_src {