From c1568a3a6c61252d5fc003602f00c0264a196822 Mon Sep 17 00:00:00 2001 From: ossifrage <82336322+ossifrage@users.noreply.github.com> Date: Sat, 24 Apr 2021 21:20:15 -0700 Subject: 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. --- player/lua/osc.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player/lua/osc.lua b/player/lua/osc.lua index af59470335..9e1978bfc3 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -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() -- cgit v1.2.3