summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-23 19:10:38 +0100
committerwm4 <wm4@nowhere>2015-12-23 19:10:48 +0100
commit3e1aed8f40f0c35f78c74502050630519895c972 (patch)
tree72a8cd2608e7a841c0efd268ddbb7ff0a687745f /player
parentff520054c86898613ae58f358b8554760ef30e15 (diff)
downloadmpv-3e1aed8f40f0c35f78c74502050630519895c972.tar.bz2
mpv-3e1aed8f40f0c35f78c74502050630519895c972.tar.xz
input: add key name to script-binding command response
The "script-binding" command is used by the Lua scripting wrapper to register key bindings on the fly. It's also the only way to get fine- grained information about key events (such as separate key up/down events). This information is sent via a "key-binding" message when the state of a key changes. Extend it to send name of the mapped key itself. Previously, it was assumed that the user just uses an unique identifier for the binding's name, so it wasn't needed. With this change, a user can map exactly the same command to multiple keys, which is useful especially with the next commit. Part of #2612.
Diffstat (limited to 'player')
-rw-r--r--player/command.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index eec4f45dc0..6bb811dfd5 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4908,8 +4908,8 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
char state[3] = {'p', cmd->is_mouse_button ? 'm' : '-'};
if (cmd->is_up_down)
state[0] = cmd->repeated ? 'r' : (cmd->is_up ? 'u' : 'd');
- event.num_args = 3;
- event.args = (const char*[3]){"key-binding", name, state};
+ event.num_args = 4;
+ event.args = (const char*[4]){"key-binding", name, state, cmd->key_name};
if (mp_client_send_event_dup(mpctx, target,
MPV_EVENT_CLIENT_MESSAGE, &event) < 0)
{