mirror of
https://github.com/mpv-player/mpv
synced 2025-02-03 05:31:34 +00:00
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.
This commit is contained in:
parent
61a387ac95
commit
0d384592c5
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user