mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Partial rerendering: really avoid flash on reload (#10155)
Also restore input if ReaderUI crashed. Also avoid refresh_count management when "Full refresh rate" is set to "never".
This commit is contained in:
@@ -608,6 +608,9 @@ function ReaderUI:showReaderCoroutine(file, provider, seamless)
|
||||
if err ~= nil or ok == false then
|
||||
io.stderr:write('[!] doShowReader coroutine crashed:\n')
|
||||
io.stderr:write(debug.traceback(co, err, 1))
|
||||
-- Restore input if we crashed before ReaderUI has restored it
|
||||
Device:setIgnoreInput(false)
|
||||
Input:inhibitInputUntil(0.2)
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("No reader engine for this file or invalid file.")
|
||||
})
|
||||
@@ -617,6 +620,9 @@ function ReaderUI:showReaderCoroutine(file, provider, seamless)
|
||||
end
|
||||
|
||||
function ReaderUI:doShowReader(file, provider, seamless)
|
||||
if seamless then
|
||||
UIManager:avoidFlashOnNextRepaint()
|
||||
end
|
||||
logger.info("opening file", file)
|
||||
-- Only keep a single instance running
|
||||
if ReaderUI.instance then
|
||||
|
||||
@@ -1123,7 +1123,7 @@ function UIManager:_refresh(mode, region, dither)
|
||||
-- (Putting "ui" in that list is problematic with a number of UI elements, most notably, ReaderHighlight,
|
||||
-- because it is implemented as "ui" over the full viewport, since we can't devise a proper bounding box).
|
||||
-- So we settle for only "partial", but treating full-screen ones slightly differently.
|
||||
if mode == "partial" and not self.refresh_counted then
|
||||
if mode == "partial" and self.FULL_REFRESH_COUNT > 0 and not self.refresh_counted then
|
||||
self.refresh_count = (self.refresh_count + 1) % self.FULL_REFRESH_COUNT
|
||||
if self.refresh_count == self.FULL_REFRESH_COUNT - 1 then
|
||||
-- NOTE: Promote to "full" if no region (reader), to "flashui" otherwise (UI)
|
||||
@@ -1290,6 +1290,11 @@ function UIManager:forceRePaint()
|
||||
self:_repaint()
|
||||
end
|
||||
|
||||
function UIManager:avoidFlashOnNextRepaint()
|
||||
-- Avoid going through the "partial" to "full" refresh promotion: pretend we already checked that.
|
||||
self.refresh_counted = true
|
||||
end
|
||||
|
||||
--[[--
|
||||
Ask the EPDC to *block* until our previous refresh ioctl has completed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user