Prevent automatic footer refreshes from drawing the footer on top of stuff that isn't ReaderUI (#6648)

* Prevent refreshing the footer automatically where it doesn't make sense to.

Issue exposed by #6540
Fix #6616
This commit is contained in:
NiLuJe
2020-09-12 22:57:53 +02:00
committed by GitHub
parent b031d1c359
commit e0546d0fc8
4 changed files with 68 additions and 5 deletions

View File

@@ -1795,11 +1795,13 @@ function ReaderFooter:_updateFooterText(force_repaint, force_recompute)
-- Unfortunately, it's not a modal (we never show() it), so it's not in the window stack,
-- instead, it's baked inside ReaderUI, so it gets slightly trickier...
-- NOTE: self.view.footer -> self ;).
UIManager:setDirty(self.view.footer, function()
return "ui", refresh_dim
end)
-- c.f., ReaderView:paintTo()
UIManager:widgetRepaint(self.view.footer, 0, 0)
if UIManager:repaintReaderFooter(self.view.footer) then
-- NOTE: repaintReaderFooter will sometimes choose *not* to repaint, in which case,
-- we don't want to generate a bogus setDirty call ;).
UIManager:setDirty(self.view.footer, function()
return "ui", refresh_dim
end)
end
else
UIManager:setDirty(self.view.dialog, function()
return "ui", refresh_dim
@@ -2005,6 +2007,16 @@ function ReaderFooter:onSuspend()
end
end
-- We want to be able to disable auto_refresh_time when displaying *some* non-fullscreen widgets on top of ReaderUI,
-- otherwise it'll happily keep on ticking and drawing on top of stuff it ought not to... (#6616)
--- @note: If the widget actually makes it to UIManager's window stack (i.e., it's passed to UIManager:show()),
--- it's generally simpler to set covers_footer when initializing the Widget object.
-- Since these Events are not currently in use, comment the handlers out ;).
--[[
ReaderFooter.onDisableFooterAutoRefresh = ReaderFooter.onSuspend
ReaderFooter.onRestoreFooterAutoRefresh = ReaderFooter.onResume
--]]
function ReaderFooter:onFrontlightStateChanged()
if self.settings.frontlight then
self:onUpdateFooter(true)