summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2014-05-29 23:37:47 +0200
committerwm4 <wm4@nowhere>2014-06-02 22:20:25 +0200
commitd838bd64202464e392e330ed3240307c34f2c4bf (patch)
treed13dff9620c74867a490ed07d3bc1541b8dcf2b0 /player
parent58b070d17868843dd62226b406b7062687a01250 (diff)
downloadmpv-d838bd64202464e392e330ed3240307c34f2c4bf.tar.bz2
mpv-d838bd64202464e392e330ed3240307c34f2c4bf.tar.xz
osc: keep track of the "fullscreen" state when it changes
This avoids having to poll the "fullscreen" property in the tick callback.
Diffstat (limited to 'player')
-rw-r--r--player/lua/osc.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index 02044698ca..1fc3522230 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -72,6 +72,7 @@ local state = {
last_mouseX, last_mouseY, -- last mouse position, to detect siginificant mouse movement
message_text,
message_timeout,
+ fullscreen = false,
}
@@ -587,7 +588,7 @@ function osc_init()
if (mp.get_property("video") == "no") then -- dummy/forced window
scale = user_opts.scaleforcedwindow
- elseif (mp.get_property("fullscreen") == "yes") then
+ elseif state.fullscreen then
scale = user_opts.scalefullscreen
else
scale = user_opts.scalewindowed
@@ -820,7 +821,7 @@ function osc_init()
--toggle FS
local contentF = function (ass)
- if mp.get_property("fullscreen") == "yes" then
+ if state.fullscreen then
ass:append("\238\132\137")
else
ass:append("\238\132\136")
@@ -1171,7 +1172,7 @@ end
-- called by mpv on every frame
function tick()
- if (mp.get_property("fullscreen") == "yes" and user_opts.showfullscreen) or (mp.get_property("fullscreen") == "no" and user_opts.showwindowed) then
+ if (state.fullscreen and user_opts.showfullscreen) or (not state.fullscreen and user_opts.showwindowed) then
render()
else
mp.set_osd_ass(osc_param.playresy, osc_param.playresy, "")
@@ -1195,6 +1196,8 @@ mp.register_event("tracks-changed", request_init)
mp.register_script_message("enable-osc", function() enable_osc(true) end)
mp.register_script_message("disable-osc", function() enable_osc(false) end)
+mp.observe_property("fullscreen", "bool", function(name, val) state.fullscreen = val end)
+
-- mouse show/hide bindings
mp.set_key_bindings({
{"mouse_move", function(e) process_event("mouse_move", nil) end},