diff options
author | James Ross-Gowan <rossy@jrg.systems> | 2017-09-03 00:00:52 +1000 |
---|---|---|
committer | James Ross-Gowan <rossy@jrg.systems> | 2017-09-03 20:31:44 +1000 |
commit | 7897f79217af1e04e6e65bd72e938058e84c451a (patch) | |
tree | 0a0a6434ddcf5f97b3eebfd159d01647ee1f3ffa /player | |
parent | 8fe4aa94ee7e5400450c124397c8edabfd6d726b (diff) | |
download | mpv-7897f79217af1e04e6e65bd72e938058e84c451a.tar.bz2 mpv-7897f79217af1e04e6e65bd72e938058e84c451a.tar.xz |
input: merge mouse wheel and axis keycodes
Mouse wheel bindings have always been a cause of user confusion.
Previously, on Wayland and macOS, precise touchpads would generate AXIS
keycodes and notched mouse wheels would generate mouse button keycodes.
On Windows, both types of device would generate AXIS keycodes and on
X11, both types of device would generate mouse button keycodes. This
made it pretty difficult for users to modify their mouse-wheel bindings,
since it differed between platforms and in some cases, between devices.
To make it more confusing, the keycodes used on Windows were changed in
18a45a42d524 without a deprecation period or adequate communication to
users.
This change aims to make mouse wheel binds less confusing. Both the
mouse button and AXIS keycodes are now deprecated aliases of the new
WHEEL keycodes. This will technically break input configs on Wayland and
macOS that assign different commands to precise and non-precise scroll
events, but this is probably uncommon (if anyone does it at all) and I
think it's a fair tradeoff for finally fixing mouse wheel-related
confusion on other platforms.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 4 | ||||
-rw-r--r-- | player/lua/osc.lua | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/player/command.c b/player/command.c index 6056fb8d8c..6dc619d0eb 100644 --- a/player/command.c +++ b/player/command.c @@ -5601,12 +5601,12 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re return -1; } const bool dbc = cmd->args[3].v.i; - if (dbc && button > (MP_MBTN_RIGHT - MP_MOUSE_BASE)) { + if (dbc && button > (MP_MBTN_RIGHT - MP_MBTN_BASE)) { MP_ERR(mpctx, "%d is not a valid mouse button for double-clicks.\n", button); return -1; } - button += dbc ? MP_MOUSE_DBL_BASE : MP_MOUSE_BASE; + button += dbc ? MP_MBTN_DBL_BASE : MP_MBTN_BASE; mp_input_set_mouse_pos_artificial(mpctx->input, x, y); mp_input_put_key_artificial(mpctx->input, button); break; diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 1359260521..e4faf6c0cc 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -2304,8 +2304,6 @@ mp.set_key_bindings({ function(e) process_event("mbtn_right", "down") end}, {"wheel_up", function(e) process_event("wheel_up", "press") end}, {"wheel_down", function(e) process_event("wheel_down", "press") end}, - {"axis_up", function(e) process_event("wheel_up", "press") end}, - {"axis_down", function(e) process_event("wheel_down", "press") end}, {"mbtn_left_dbl", "ignore"}, {"shift+mbtn_left_dbl", "ignore"}, {"mbtn_right_dbl", "ignore"}, |