mirror of https://github.com/mpv-player/mpv
input/cmd: add nonrepeatable prefix
This allows forcing certain commands to be non-repeatable, e.g. volume.
This commit is contained in:
parent
e6e0aaa6c6
commit
bc5863a631
|
@ -0,0 +1 @@
|
|||
add `nonrepeatable` input command prefix
|
|
@ -1818,6 +1818,9 @@ prefixes can be specified. They are separated by whitespace.
|
|||
This prefix forces enabling key repeat in any case. For a list of commands:
|
||||
the first command determines the repeatability of the whole list (up to and
|
||||
including version 0.33 - a list was always repeatable).
|
||||
``nonrepeatable``
|
||||
For some commands, keeping a key pressed runs the command repeatedly.
|
||||
This prefix forces disabling key repeat in any case.
|
||||
``async``
|
||||
Allow asynchronous execution (if possible). Note that only a few commands
|
||||
will support this (usually this is explicitly documented). Some commands
|
||||
|
|
|
@ -51,9 +51,10 @@ static const struct flag cmd_flags[] = {
|
|||
{"osd-auto", MP_ON_OSD_FLAGS, MP_ON_OSD_AUTO},
|
||||
{"expand-properties", 0, MP_EXPAND_PROPERTIES},
|
||||
{"raw", MP_EXPAND_PROPERTIES, 0},
|
||||
{"repeatable", 0, MP_ALLOW_REPEAT},
|
||||
{"repeatable", MP_DISALLOW_REPEAT, MP_ALLOW_REPEAT},
|
||||
{"nonrepeatable", MP_ALLOW_REPEAT, MP_DISALLOW_REPEAT},
|
||||
{"async", MP_SYNC_CMD, MP_ASYNC_CMD},
|
||||
{"sync", MP_ASYNC_CMD, MP_SYNC_CMD},
|
||||
{"sync", MP_ASYNC_CMD, MP_SYNC_CMD},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -611,7 +612,8 @@ bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd)
|
|||
if (cmd->def == &mp_cmd_list && cmd->args[0].v.p)
|
||||
cmd = cmd->args[0].v.p; // list - only 1st cmd is considered
|
||||
|
||||
return (cmd->def->allow_auto_repeat) || (cmd->flags & MP_ALLOW_REPEAT);
|
||||
return (cmd->def->allow_auto_repeat && !(cmd->flags & MP_DISALLOW_REPEAT)) ||
|
||||
(cmd->flags & MP_ALLOW_REPEAT);
|
||||
}
|
||||
|
||||
bool mp_input_is_scalable_cmd(struct mp_cmd *cmd)
|
||||
|
|
|
@ -75,6 +75,8 @@ enum mp_cmd_flags {
|
|||
MP_ASYNC_CMD = 32, // do not wait for command to complete
|
||||
MP_SYNC_CMD = 64, // block on command completion
|
||||
|
||||
MP_DISALLOW_REPEAT = 128, // if used as keybinding, disallow key repeat
|
||||
|
||||
MP_ON_OSD_FLAGS = MP_ON_OSD_NO | MP_ON_OSD_AUTO |
|
||||
MP_ON_OSD_BAR | MP_ON_OSD_MSG,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue