summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-17 18:27:44 +0100
committerwm4 <wm4@nowhere>2014-03-17 18:27:44 +0100
commit791068d255f8444d9b144a3f7cc9259075fbb2fd (patch)
tree47ca24fc24b6d1f57b55633c25041f673aebaf28
parent780f172a8a09bbd4a1ce5a582ba26b5737788d3b (diff)
downloadmpv-791068d255f8444d9b144a3f7cc9259075fbb2fd.tar.bz2
mpv-791068d255f8444d9b144a3f7cc9259075fbb2fd.tar.xz
osc: add enable/disable message, and map DEL to disabling the OSC
"enable-osc" will make the OSC appear at any time (although it'll quickly disappear again if the mouse is not inside the OSC). "disable- osc" will make it disappear permanently. Also, if the OSC is visible, force remap the DEL key to make the OSC disappear.
-rw-r--r--player/lua/osc.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 4f217d33c5..9a575f657a 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -1257,10 +1257,23 @@ function tick()
end
end
+function enable_osc(enable)
+ if enable then
+ mp.enable_key_bindings("showhide")
+ show_osc()
+ else
+ hide_osc()
+ mp.disable_key_bindings("showhide")
+ end
+end
+
mp.register_event("tick", tick)
mp.register_event("start-file", request_init)
mp.register_event("tracks-changed", request_init)
+mp.register_script_message("enable-osc", function() enable_osc(true) end)
+mp.register_script_message("disable-osc", function() enable_osc(false) end)
+
-- mouse show/hide bindings
mp.set_key_bindings({
{"mouse_move", function(e) process_event("mouse_move", nil) end},
@@ -1279,5 +1292,6 @@ mp.set_key_bindings({
{"mouse_btn0_dbl", "ignore"},
{"shift+mouse_btn0_dbl", "ignore"},
{"mouse_btn2_dbl", "ignore"},
+ {"del", function() enable_osc(false) end}
}, "input", "force")
mp.enable_key_bindings("input")