summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/lua/osc.lua24
1 files changed, 23 insertions, 1 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 9047db45bb..872eead52d 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -2058,6 +2058,7 @@ function osc_init()
reset_margins()
end
+ update_margins()
end
function reset_margins()
@@ -2069,6 +2070,24 @@ function reset_margins()
end
end
+function update_margins()
+ local margins = osc_param.video_margins
+
+ -- Don't report margins if it's visible only temporarily. At least for
+ -- console.lua this makes no sense.
+ if (not state.osc_visible) or (user_opts.hidetimeout >= 0) then
+ margins = {l = 0, r = 0, t = 0, b = 0}
+ end
+
+ utils.shared_script_property_set("osc-margins",
+ string.format("%f,%f,%f,%f", margins.l, margins.r, margins.t, margins.b))
+end
+
+function shutdown()
+ reset_margins()
+ utils.shared_script_property_set("osc-margins", nil)
+end
+
--
-- Other important stuff
--
@@ -2110,6 +2129,7 @@ end
function osc_visible(visible)
state.osc_visible = visible
control_timer()
+ update_margins()
end
function pause_state(name, enabled)
@@ -2478,7 +2498,7 @@ end
validate_user_opts()
-mp.register_event("shutdown", reset_margins)
+mp.register_event("shutdown", shutdown)
mp.register_event("start-file", request_init)
mp.register_event("tracks-changed", request_init)
mp.observe_property("playlist", nil, request_init)
@@ -2609,6 +2629,8 @@ function visibility_mode(mode, no_osd)
if not no_osd and tonumber(mp.get_property("osd-level")) >= 1 then
mp.osd_message("OSC visibility: " .. mode)
end
+
+ update_margins()
end
visibility_mode(user_opts.visibility, true)