summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-08 02:37:12 +0100
committerwm4 <wm4@nowhere>2020-01-08 02:37:12 +0100
commit1c83ded3b0be1814ccee61a7f36229bb01e7c1b5 (patch)
tree47fa5f781cfda63bfd02fc49d267ceb7af74c187
parent4a65c22c500b9c6c96e7578babffcec0c78ef948 (diff)
downloadmpv-1c83ded3b0be1814ccee61a7f36229bb01e7c1b5.tar.bz2
mpv-1c83ded3b0be1814ccee61a7f36229bb01e7c1b5.tar.xz
osc: don't delay updates on resize
The idea is that if the player is resized, we do not delay redrawing (which is normally done to limit the redraw rate to something reasonable). Not sure if this even does anything. For one, reacting to osd-dimensions changes is cleaner than just polling the screen size with the next tick event, and hoping that resizes generate tick events for whatever logically unrelated reasons.
-rw-r--r--player/lua/osc.lua23
1 files changed, 19 insertions, 4 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index be139222c1..651bb58e74 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -2191,6 +2191,16 @@ end
function request_init()
state.initREQ = true
+ request_tick()
+end
+
+-- Like request_init(), but also request an immediate update
+function request_init_resize()
+ request_init()
+ -- ensure immediate update
+ state.tick_timer:kill()
+ state.tick_timer.timeout = 0
+ state.tick_timer:resume()
end
function render_wipe()
@@ -2208,7 +2218,7 @@ function render()
if not (state.mp_screen_sizeX == current_screen_sizeX
and state.mp_screen_sizeY == current_screen_sizeY) then
- request_init()
+ request_init_resize()
state.mp_screen_sizeX = current_screen_sizeX
state.mp_screen_sizeY = current_screen_sizeY
@@ -2556,19 +2566,19 @@ end)
mp.observe_property("fullscreen", "bool",
function(name, val)
state.fullscreen = val
- request_init()
+ request_init_resize()
end
)
mp.observe_property("border", "bool",
function(name, val)
state.border = val
- request_init()
+ request_init_resize()
end
)
mp.observe_property("window-maximized", "bool",
function(name, val)
state.maximized = val
- request_init()
+ request_init_resize()
end
)
mp.observe_property("idle-active", "bool",
@@ -2585,6 +2595,11 @@ end)
mp.observe_property("playback-time", "number", function(name, val)
request_tick()
end)
+mp.observe_property("osd-dimensions", "native", function(name, val)
+ -- (we could use the value instead of re-querying it all the time, but then
+ -- we might have to worry about property update ordering)
+ request_init_resize()
+end)
-- mouse show/hide bindings
mp.set_key_bindings({