summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2016-02-14 05:20:54 +0200
committerChrisK2 <spam@kalania.de>2016-02-27 22:19:30 +0100
commit3ab6af4f59dd21e3c9c514a25be380f883d608fe (patch)
tree5cd69c15f9928050ce824b017da9277e58d5f457 /player/lua
parent49660bcc3efa6ec6d86db30fa9d0b71b6a06b7d7 (diff)
downloadmpv-3ab6af4f59dd21e3c9c514a25be380f883d608fe.tar.bz2
mpv-3ab6af4f59dd21e3c9c514a25be380f883d608fe.tar.xz
osc: fix runtime enable_osc(true/false)
There were few issues: - When it's disabled and then enabled, it was displaying the osc briefly and then autohide right away. Don't do that. - When it's enabled and then disabled, it was not removing the osc from screen if called while the osc is visible (because tick() is responsible for the hide but it doesn't render() the empty osc when the osc is disabled). - Due to delayed/async unbinding of mouse events it was possible to show_osc() after it got disabled e.g. from mouse_move. Prevent this.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/osc.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 993c103f3f..9643a0aa35 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -1607,6 +1607,9 @@ end
function show_osc()
+ -- show when disabled can happen (e.g. mouse_move) due to async/delayed unbinding
+ if not state.enabled then return end
+
msg.debug("show_osc")
--remember last time of invocation (mouse move)
state.showtime = mp.get_time()
@@ -1616,12 +1619,17 @@ function show_osc()
if (user_opts.fadeduration > 0) then
state.anitype = nil
end
-
end
function hide_osc()
msg.debug("hide_osc")
- if (user_opts.fadeduration > 0) then
+ if not state.enabled then
+ -- typically hide happens at render() from tick(), but now tick() is
+ -- no-op and won't render again to remove the osc, so do that manually.
+ state.osc_visible = false
+ timer_stop()
+ render() -- state.osc_visible == false -> remove the osc from screen
+ elseif (user_opts.fadeduration > 0) then
if not(state.osc_visible == false) then
state.anitype = "out"
control_timer()
@@ -1958,9 +1966,8 @@ function enable_osc(enable)
state.enabled = enable
if enable then
do_enable_keybindings()
- show_osc()
else
- hide_osc()
+ hide_osc() -- acts immediately when state.enabled == false
if state.showhide_enabled then
mp.disable_key_bindings("showhide")
end