summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorossifrage <82336322+ossifrage@users.noreply.github.com>2021-04-15 09:44:23 -0700
committeravih <avih@users.noreply.github.com>2021-04-27 14:12:05 +0300
commit0d384592c57771a0371399783238c490def1b231 (patch)
treea20c47bc11dd9fd65a7cdeb346a5fd88ebcd0aa6 /player/lua
parent61a387ac952d8334f26dd2d2efe150bcdcbbaafa (diff)
downloadmpv-0d384592c57771a0371399783238c490def1b231.tar.bz2
mpv-0d384592c57771a0371399783238c490def1b231.tar.xz
osc: reset margins when using boxvideo with showfullscreen/showwindowed
This fixes a bug where using boxvideo with showfullscreen=no or showwindowed=no resulted in the margins not resetting when the OSC wasn't visible. For example, using: script-opts=osc-visibility=always,osc-boxvideo=yes,osc-showfullscreen=no and then going fullscreen would make the OSC disappear but the video margins would remain. This is because boxvideo was missing a dependence on the showfullscreen and showwindowed user options. This is fixed by adding the corresponding conditions to update_margins() and setting state.marginsREQ on fullscreen changes. update_margins() is called on tick() if there's a margins update pending, which guarantees the boxvideo margins are reset appropriately.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/osc.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 9e1978bfc3..bea95e1323 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -101,6 +101,7 @@ local state = {
tc_ms = user_opts.timems, -- Should the timecodes display their time with milliseconds
mp_screen_sizeX, mp_screen_sizeY, -- last screen-resolution, to detect resolution changes to issue reINITs
initREQ = false, -- is a re-init request pending?
+ marginsREQ = false, -- is a margins update pending?
last_mouseX, last_mouseY, -- last mouse position, to detect significant mouse movement
mouse_in_window = false,
message_text,
@@ -2099,7 +2100,10 @@ function update_margins()
local margins = osc_param.video_margins
-- Don't use margins if it's visible only temporarily.
- if (not state.osc_visible) or (get_hidetimeout() >= 0) then
+ if (not state.osc_visible) or (get_hidetimeout() >= 0) or
+ (state.fullscreen and not user_opts.showfullscreen) or
+ (not state.fullscreen and not user_opts.showwindowed)
+ then
margins = {l = 0, r = 0, t = 0, b = 0}
end
@@ -2505,6 +2509,11 @@ local santa_hat_lines = {
-- called by mpv on every frame
function tick()
+ if state.marginsREQ == true then
+ update_margins()
+ state.marginsREQ = false
+ end
+
if (not state.enabled) then return end
if (state.idle) then
@@ -2608,6 +2617,7 @@ end)
mp.observe_property("fullscreen", "bool",
function(name, val)
state.fullscreen = val
+ state.marginsREQ = true
request_init_resize()
end
)