1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00

osc: display immediately when visibility changes from never to always

Clearing state.osd.data with an empty string at render_wipe() fixes an
issue where changing the OSC visibility from "never" directly to
"always" didn't immediately update the display when the player was
paused. This could be verified by starting the player with
`--script-opts=osc-visibility=always --pause` and then running
`script-message osc-visibility never` followed by
`script-message osc-visibility always`.

Removing the overlay without changing the contents meant the overlay
wouldn't update and display when enabled again until the fields changed
in some way (e.g. seeking, mousing over the OSC area, etc.). Clearing
state.osd.data before removal of the OSC makes sure set_osd doesn't
return on re-enable and instead displays the OSC immediately as the data
is now different.

render_wipe() is now also used when the OSC needs to be cleared at
tick() as using set_osd to clear it with an empty string did not call
state.osd:remove() which can allow cleanups related to bitmap memory
allocations etc.
This commit is contained in:
ossifrage 2021-04-24 21:20:15 -07:00 committed by avih
parent d3b7732aaa
commit c1568a3a6c

View File

@ -2236,6 +2236,7 @@ end
function render_wipe()
msg.trace("render_wipe()")
state.osd.data = "" -- allows set_osd to immediately update on enable
state.osd:remove()
end
@ -2548,7 +2549,7 @@ function tick()
render()
else
-- Flush OSD
set_osd(osc_param.playresy, osc_param.playresy, "")
render_wipe()
end
state.tick_last_time = mp.get_time()