summaryrefslogtreecommitdiff
path: root/osd.lua
diff options
context:
space:
mode:
Diffstat (limited to 'osd.lua')
-rw-r--r--osd.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/osd.lua b/osd.lua
index e241d24..542a8ad 100644
--- a/osd.lua
+++ b/osd.lua
@@ -544,6 +544,11 @@ end
function mt:redraw(state)
self.redraw_time = os.time()
+ local next_redraw = math.huge
+ if self.redraw_timer then
+ self.redraw_timer:kill()
+ self.redraw_timer = nil
+ end
local out_titles = {}
local out_options = {}
@@ -598,6 +603,8 @@ function mt:redraw(state)
info.selected = true
out_max[#out_max+1] = self:option_icons(opt, info) .. str
+
+ next_redraw = math.min(next_redraw, opt._exp or math.huge)
end
self.out = {
@@ -622,6 +629,13 @@ function mt:redraw(state)
self:render()
self.needs_redraw = false
+
+ if next_redraw ~= math.huge then
+ local d = math.max(0.1, next_redraw - os.time())
+ self.redraw_timer = mp.add_timeout(d, function()
+ self:redraw(state)
+ end)
+ end
end
function mt:toggle_hidden()