From 6710527a832a253439cb31862bd568380f41efec Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 26 May 2014 21:49:14 +0200 Subject: input: make combined commands repeatable Binding multiple commands at once where always considered not repeatable, because the MP_CMD_COMMAND_LIST wasn't considered repeatable. Fixes #807 (probably). --- input/cmd_list.c | 6 ++++++ input/cmd_list.h | 2 ++ input/input.c | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'input') diff --git a/input/cmd_list.c b/input/cmd_list.c index 9d4409ed8e..24ef6e7a0e 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -285,6 +285,12 @@ bool mp_input_is_abort_cmd(struct mp_cmd *cmd) return false; } +bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd) +{ + return (cmd->def && cmd->def->allow_auto_repeat) || + cmd->id == MP_CMD_COMMAND_LIST; +} + void mp_print_cmd_list(struct mp_log *out) { for (int i = 0; mp_cmds[i].name; i++) { diff --git a/input/cmd_list.h b/input/cmd_list.h index b4085decb8..f061814f23 100644 --- a/input/cmd_list.h +++ b/input/cmd_list.h @@ -116,6 +116,8 @@ enum mp_command_type { struct mp_cmd; bool mp_input_is_abort_cmd(struct mp_cmd *cmd); +bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd); + struct bstr; bool mp_replace_legacy_cmd(void *talloc_ctx, struct bstr *s); diff --git a/input/input.c b/input/input.c index 6748e5930d..299657f335 100644 --- a/input/input.c +++ b/input/input.c @@ -515,7 +515,7 @@ static void update_mouse_section(struct input_ctx *ictx) } // Called when the currently held-down key is released. This (usually) sends -// the a key-up versiob of the command associated with the keys that were held +// the a key-up version of the command associated with the keys that were held // down. // If the drop_current parameter is set to true, then don't send the key-up // command. Unless we've already sent a key-down event, in which case the @@ -1112,7 +1112,7 @@ mp_cmd_t *mp_input_get_cmd(struct input_ctx *ictx, int time, int peek_only) struct mp_cmd *repeated = check_autorepeat(ictx); if (repeated) { repeated->repeated = true; - if (repeated->def && repeated->def->allow_auto_repeat) { + if (mp_input_is_repeatable_cmd(repeated)) { queue_add_tail(queue, repeated); } else { talloc_free(repeated); -- cgit v1.2.3