2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

ScreenSaver: On race-y platforms, only force a refresh on close if the

widget was actually closed *immediately*.

If it's delayed (by time, tap or gesture), leave it alone.

Fix #9285
This commit is contained in:
NiLuJe 2022-08-11 16:45:49 +02:00
parent 8e7dddd927
commit e3228abb19
3 changed files with 11 additions and 6 deletions

View File

@ -273,8 +273,8 @@ function Device:onPowerEvent(ev)
end
end
self:resume()
Screensaver:close()
if self:needsScreenRefreshAfterResume() then
local widget_was_closed = Screensaver:close()
if widget_was_closed and self:needsScreenRefreshAfterResume() then
UIManager:scheduleIn(1, function() self.screen:refreshFull() end)
end
self.screen_saver_mode = false

View File

@ -273,10 +273,12 @@ function Kindle:outofScreenSaver()
if self.screen_saver_mode == true then
if self:supportsScreensaver() then
local Screensaver = require("ui/screensaver")
Screensaver:close()
-- And redraw everything in case the framework managed to screw us over...
local UIManager = require("ui/uimanager")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
local widget_was_closed = Screensaver:close()
if widget_was_closed then
-- And redraw everything in case the framework managed to screw us over...
local UIManager = require("ui/uimanager")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
end
else
-- Stop awesome again if need be...
if os.getenv("AWESOME_STOPPED") == "yes" then

View File

@ -776,6 +776,9 @@ function Screensaver:close()
self.delayed_close = true
elseif screensaver_delay == "disable" then
self:close_widget()
-- NOTE: Notify platforms that race with the native system (e.g., Kindle or needsScreenRefreshAfterResume)
-- that we've actually closed the widget *right now*.
return true
elseif screensaver_delay == "gesture" then
if self.screensaver_widget then
self.screensaver_widget:showWaitForGestureMessage()