Skip to content

Commit

Permalink
Strip out shared_script_properties support
Browse files Browse the repository at this point in the history
Due to the raised mpv version requirement of 0.39,
shared_script_properties don't exist anymore.
  • Loading branch information
christoph-heinrich committed Oct 4, 2024
1 parent 4902248 commit 1753f78
Showing 1 changed file with 11 additions and 34 deletions.
45 changes: 11 additions & 34 deletions quality-menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -659,43 +659,20 @@ local function text_menu_open(formats, active_format, menu_type)
draw_menu()
end

local update_margins;
if utils.shared_script_property_set then
update_margins = function()
local shared_props = mp.get_property_native('shared-script-properties')
local val = shared_props['osc-margins']
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
margin_top = vals[3] -- top
margin_bottom = vals[4] -- bottom
else
margin_top = 0
margin_bottom = 0
end
draw_menu()
local update_margins = function(_, val)
if not val then
val = mp.get_property_native('user-data/osc/margins')
end
mp.observe_property('shared-script-properties', 'native', update_margins)
else
update_margins = function(_, val)
if not val then
val = mp.get_property_native('user-data/osc/margins')
end
if val then
margin_top = val.t
margin_bottom = val.b
else
margin_top = 0
margin_bottom = 0
end
draw_menu()
if val then
margin_top = val.t
margin_bottom = val.b
else
margin_top = 0
margin_bottom = 0
end
mp.observe_property('user-data/osc/margins', 'native', update_margins)
draw_menu()
end
mp.observe_property('user-data/osc/margins', 'native', update_margins)

update_dimensions()
update_margins()
Expand Down

0 comments on commit 1753f78

Please sign in to comment.