summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
Diffstat (limited to 'input')
-rw-r--r--input/cmd_parse.c3
-rw-r--r--input/input.c2
-rw-r--r--input/input.h1
3 files changed, 5 insertions, 1 deletions
diff --git a/input/cmd_parse.c b/input/cmd_parse.c
index b0c6c50753..0af9665cf0 100644
--- a/input/cmd_parse.c
+++ b/input/cmd_parse.c
@@ -140,7 +140,7 @@ struct mp_cmd *mp_input_parse_cmd_node(struct mp_log *log, mpv_node *node)
{
struct mp_cmd *cmd = talloc_ptrtype(NULL, cmd);
talloc_set_destructor(cmd, destroy_cmd);
- *cmd = (struct mp_cmd) { .scale = 1, };
+ *cmd = (struct mp_cmd) { .scale = 1, .scale_units = 1 };
if (node->format != MPV_FORMAT_NODE_ARRAY)
goto error;
@@ -254,6 +254,7 @@ static struct mp_cmd *parse_cmd_str(struct mp_log *log, void *tmp,
*cmd = (struct mp_cmd) {
.flags = MP_ON_OSD_AUTO | MP_EXPAND_PROPERTIES,
.scale = 1,
+ .scale_units = 1,
};
ctx->str = bstr_lstrip(ctx->str);
diff --git a/input/input.c b/input/input.c
index 04b61cf3b4..c859e5e3db 100644
--- a/input/input.c
+++ b/input/input.c
@@ -618,11 +618,13 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale,
if (mp_input_is_scalable_cmd(cmd)) {
cmd->scale = scale;
+ cmd->scale_units = scale_units;
mp_input_queue_cmd(ictx, cmd);
} else {
// Non-scalable commands won't understand cmd->scale, so synthesize
// multiple commands with cmd->scale = 1
cmd->scale = 1;
+ cmd->scale_units = 1;
// Avoid spamming the player with too many commands
scale_units = FFMIN(scale_units, 20);
for (int i = 0; i < scale_units - 1; i++)
diff --git a/input/input.h b/input/input.h
index dfc14078f3..c2933e8bd3 100644
--- a/input/input.h
+++ b/input/input.h
@@ -85,6 +85,7 @@ typedef struct mp_cmd {
int mouse_x, mouse_y;
struct mp_cmd *queue_next;
double scale; // for scaling numeric arguments
+ int scale_units;
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