1
mirror of https://github.com/mpv-player/mpv synced 2024-11-03 03:19:24 +01:00

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.
This commit is contained in:
wm4 2014-03-17 18:27:44 +01:00
parent 780f172a8a
commit 791068d255

View File

@ -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")