summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-18 09:04:15 +0100
committerwm4 <wm4@nowhere>2019-12-18 09:04:15 +0100
commit09ea3a424fee80636f38e6615af5fbe8a3bdb896 (patch)
tree27b85ac49233e4a7b07fec168bec7096584e5ab5
parent4787eb594a879619b9acd266bac015bfd0032c50 (diff)
downloadmpv-09ea3a424fee80636f38e6615af5fbe8a3bdb896.tar.bz2
mpv-09ea3a424fee80636f38e6615af5fbe8a3bdb896.tar.xz
console: adjust position to OSC
See previous commit.
-rw-r--r--player/lua/console.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/player/lua/console.lua b/player/lua/console.lua
index 77d4fd64d1..bc74b5d313 100644
--- a/player/lua/console.lua
+++ b/player/lua/console.lua
@@ -81,6 +81,7 @@ local history = {}
local history_pos = 1
local log_buffer = {}
local key_bindings = {}
+local global_margin_y = 0
local update_timer = nil
update_timer = mp.add_periodic_timer(0.05, function()
@@ -92,6 +93,21 @@ update_timer = mp.add_periodic_timer(0.05, function()
end)
update_timer:kill()
+utils.shared_script_property_observe("osc-margins", function(_, val)
+ if val then
+ -- formatted as "%f,%f,%f,%f" with left, right, top, bottom, each
+ -- value being the border size as ratio of the window size (0.0-1.0)
+ local vals = {}
+ for v in string.gmatch(val, "[^,]+") do
+ vals[#vals + 1] = tonumber(v)
+ end
+ global_margin_y = vals[4] -- bottom
+ else
+ global_margin_y = 0
+ end
+ update()
+end)
+
-- Add a line to the log buffer (which is limited to 100 lines)
function log_add(style, text)
log_buffer[#log_buffer + 1] = { style = style, text = text }
@@ -172,7 +188,7 @@ function update()
ass:new_event()
ass:an(1)
- ass:pos(2, screeny - 2)
+ ass:pos(2, screeny - 2 - global_margin_y * screeny)
ass:append(log_ass .. '\\N')
ass:append(style .. '> ' .. before_cur)
ass:append(cglyph)