From 0e68ff4fad174d73c6e7ab82ead36f9209fb66a2 Mon Sep 17 00:00:00 2001 From: ChrisK2 Date: Fri, 27 Sep 2013 20:12:13 +0200 Subject: osc: add options to show OSC only when FS/windowed The boolean-options showWindowed and showFullscreen can now be set in plugin_osc.conf to control the behaviour. enhancement for #262 --- mpvcore/lua/osc.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'mpvcore') diff --git a/mpvcore/lua/osc.lua b/mpvcore/lua/osc.lua index a18747aa74..7b4069b87c 100644 --- a/mpvcore/lua/osc.lua +++ b/mpvcore/lua/osc.lua @@ -10,6 +10,8 @@ local msg = require 'mp.msg' -- default user option values -- do not touch, change them in plugin_osc.conf local user_opts = { + showWindowed = true, -- show OSC when windowed? + showFullscreen = true, -- show OSC when fullscreen? scaleWindowed = 1, -- scaling of the controller when windowed scaleFullscreen = 1, -- scaling of the controller when fullscreen vidscale = true, -- scale the controller with the video? @@ -35,7 +37,7 @@ local osc_param = { local osc_styles = { bigButtons = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs50\\fnmpv-osd-symbols}", - smallButtonsL = "{\\3a&HFF&\\4a&HFF&\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs20\\fnmpv-osd-symbols}", + smallButtonsL = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs20\\fnmpv-osd-symbols}", smallButtonsLlabel = "{\\fs17\\fn" .. mp.property_get("options/osd-font") .. "}", smallButtonsR = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs30\\fnmpv-osd-symbols}", @@ -1149,9 +1151,17 @@ function process_event(source, what) end end +function tick() + if (mp.property_get("fullscreen") == "yes" and user_opts.showFullscreen) or (mp.property_get("fullscreen") == "no" and user_opts.showWindowed) then + render() + else + mp.set_osd_ass(osc_param.playresy, osc_param.playresy, "") + end +end + function mp_event(name, arg) if name == "tick" then - render() + tick() elseif name == "start" or name == "track-layout" then request_init() elseif name == "end" then -- cgit v1.2.3