summaryrefslogtreecommitdiffstats
path: root/mpvcore/command.c
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-07-25 18:08:57 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-08-07 22:15:39 +0200
commit023e5ccd02609c8a2fdcf63ee0a87025beeb79f0 (patch)
tree4846330cd6d36a8d353f2c287fb061e0de3e05bb /mpvcore/command.c
parent406241005e3d897b30a5b168a16ad61f0996c43c (diff)
downloadmpv-023e5ccd02609c8a2fdcf63ee0a87025beeb79f0.tar.bz2
mpv-023e5ccd02609c8a2fdcf63ee0a87025beeb79f0.tar.xz
input: add support for precise scroll axes
Support horizontal and vertical axes of input devices. If the input device support precise scrolling with an input value then it should first be scaled to a standard multiplier, where 1.0 is the default. The multiplier will then applied to the following commands if possible: * MP_CMD_SEEK * MP_CMD_SPEED_MULT * MP_CMD_ADD All other commands will triggered on every axis event, without change the values specified in the config file.
Diffstat (limited to 'mpvcore/command.c')
-rw-r--r--mpvcore/command.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mpvcore/command.c b/mpvcore/command.c
index bc128953ce..d1513bd998 100644
--- a/mpvcore/command.c
+++ b/mpvcore/command.c
@@ -2142,7 +2142,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
switch (cmd->id) {
case MP_CMD_SEEK: {
- double v = cmd->args[0].v.d;
+ double v = cmd->args[0].v.d * cmd->scale;
int abs = cmd->args[1].v.i;
int exact = cmd->args[2].v.i;
if (abs == 2) { // Absolute seek to a timestamp in seconds
@@ -2187,7 +2187,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
.wrap = cmd->id == MP_CMD_CYCLE,
};
if (cmd->args[1].v.d)
- s.inc = cmd->args[1].v.d;
+ s.inc = cmd->args[1].v.d * cmd->scale;
int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_SWITCH, &s, mpctx);
if (r == M_PROPERTY_OK || r == M_PROPERTY_UNAVAILABLE) {
show_property_osd(mpctx, cmd->args[0].v.s, cmd->on_osd);
@@ -2221,7 +2221,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
case MP_CMD_SPEED_MULT: {
- double v = cmd->args[0].v.d;
+ double v = cmd->args[0].v.d * cmd->scale;
v *= mpctx->opts->playback_speed;
mp_property_do("speed", M_PROPERTY_SET, &v, mpctx);
show_property_osd(mpctx, "speed", cmd->on_osd);