diff --git a/frontend/apps/reader/readerui.lua b/frontend/apps/reader/readerui.lua index fa98db798..3775bd176 100644 --- a/frontend/apps/reader/readerui.lua +++ b/frontend/apps/reader/readerui.lua @@ -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 diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index ecc94210b..f0eaf7bbb 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -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.