summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-12-15 23:11:30 -0600
committersfan5 <sfan5@live.de>2023-12-21 09:13:11 +0100
commit069143252ae390a5c66eec3f971fbce8da62a2d9 (patch)
tree79012db484376d2b8f89643db164a3e6691048f6 /player/lua
parent17be6e1990a92e9b43f5f49cca9c4dd3da24a1e8 (diff)
downloadmpv-069143252ae390a5c66eec3f971fbce8da62a2d9.tar.bz2
mpv-069143252ae390a5c66eec3f971fbce8da62a2d9.tar.xz
osc: allow disabling special mouse wheel behavior
When hovering certain elements over the OSC, using the mouse wheel can result in special commands (such as seeking, changing audio tracks, etc.) Not everyone neccessarily wants this feature, so add an option to make it possible to disable all of it. Maybe more fine-tuned control would be more ideal, but probably not worth it. Fixes #13096.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/osc.lua44
1 files changed, 28 insertions, 16 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index dcc578a9eb..fb58ef5419 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -38,6 +38,7 @@ local user_opts = {
seekrangeseparate = true, -- whether the seekranges overlay on the bar-style seekbar
seekrangealpha = 200, -- transparency of seekranges
seekbarkeyframes = true, -- use keyframes when dragging the seekbar
+ scrollcontrols = true, -- allow scrolling when hovering certain OSC elements
title = "${media-title}", -- string compatible with property-expansion
-- to be shown as OSC title
tooltipborder = 1, -- border of tooltip in bottom/topbar
@@ -1937,10 +1938,13 @@ function osc_init()
function () set_track("audio", -1) end
ne.eventresponder["shift+mbtn_left_down"] =
function () show_message(get_tracklist("audio"), 2) end
- ne.eventresponder["wheel_down_press"] =
- function () set_track("audio", 1) end
- ne.eventresponder["wheel_up_press"] =
- function () set_track("audio", -1) end
+
+ if user_opts.scrollcontrols then
+ ne.eventresponder["wheel_down_press"] =
+ function () set_track("audio", 1) end
+ ne.eventresponder["wheel_up_press"] =
+ function () set_track("audio", -1) end
+ end
--cy_sub
ne = new_element("cy_sub", "button")
@@ -1960,10 +1964,13 @@ function osc_init()
function () set_track("sub", -1) end
ne.eventresponder["shift+mbtn_left_down"] =
function () show_message(get_tracklist("sub"), 2) end
- ne.eventresponder["wheel_down_press"] =
- function () set_track("sub", 1) end
- ne.eventresponder["wheel_up_press"] =
- function () set_track("sub", -1) end
+
+ if user_opts.scrollcontrols then
+ ne.eventresponder["wheel_down_press"] =
+ function () set_track("sub", 1) end
+ ne.eventresponder["wheel_up_press"] =
+ function () set_track("sub", -1) end
+ end
--tog_fs
ne = new_element("tog_fs", "button")
@@ -2053,10 +2060,13 @@ function osc_init()
"absolute-percent", "exact") end
ne.eventresponder["reset"] =
function (element) element.state.lastseek = nil end
- ne.eventresponder["wheel_up_press"] =
- function () mp.commandv("osd-auto", "seek", 10) end
- ne.eventresponder["wheel_down_press"] =
- function () mp.commandv("osd-auto", "seek", -10) end
+
+ if user_opts.scrollcontrols then
+ ne.eventresponder["wheel_up_press"] =
+ function () mp.commandv("osd-auto", "seek", 10) end
+ ne.eventresponder["wheel_down_press"] =
+ function () mp.commandv("osd-auto", "seek", -10) end
+ end
-- tc_left (current pos)
@@ -2140,10 +2150,12 @@ function osc_init()
ne.eventresponder["mbtn_left_up"] =
function () mp.commandv("cycle", "mute") end
- ne.eventresponder["wheel_up_press"] =
- function () mp.commandv("osd-auto", "add", "volume", 5) end
- ne.eventresponder["wheel_down_press"] =
- function () mp.commandv("osd-auto", "add", "volume", -5) end
+ if user_opts.scrollcontrols then
+ ne.eventresponder["wheel_up_press"] =
+ function () mp.commandv("osd-auto", "add", "volume", 5) end
+ ne.eventresponder["wheel_down_press"] =
+ function () mp.commandv("osd-auto", "add", "volume", -5) end
+ end
-- load layout