Correct Frontlight status on suspend when screensaver mode is 'Leave … (#5928)

Also use a var in place of a long function name
reviewable/pr5931/r1 v2020.03
clarkspark 4 years ago committed by GitHub
parent da8151f84a
commit 1d58eb8b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -230,8 +230,10 @@ function Device:onPowerEvent(ev)
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
logger.dbg("Suspending...") logger.dbg("Suspending...")
-- Mostly always suspend in Portrait/Inverted Portrait mode... -- Mostly always suspend in Portrait/Inverted Portrait mode...
-- ... except when we just show an InfoMessage, it plays badly with Landscape mode (c.f., #4098) -- ... except when we just show an InfoMessage or when the screensaver
if G_reader_settings:readSetting("screensaver_type") ~= "message" then -- is disabled, as it plays badly with Landscape mode (c.f., #4098 and #5290)
local screensaver_type = G_reader_settings:readSetting("screensaver_type")
if screensaver_type ~= "message" and screensaver_type ~= "disable" then
self.orig_rotation_mode = self.screen:getRotationMode() self.orig_rotation_mode = self.screen:getRotationMode()
-- Leave Portrait & Inverted Portrait alone, that works just fine. -- Leave Portrait & Inverted Portrait alone, that works just fine.
if bit.band(self.orig_rotation_mode, 1) == 1 then if bit.band(self.orig_rotation_mode, 1) == 1 then
@ -244,9 +246,8 @@ function Device:onPowerEvent(ev)
-- On eInk, if we're using a screensaver mode that shows an image, -- On eInk, if we're using a screensaver mode that shows an image,
-- flash the screen to white first, to eliminate ghosting. -- flash the screen to white first, to eliminate ghosting.
if self:hasEinkScreen() and if self:hasEinkScreen() and
G_reader_settings:readSetting("screensaver_type") == "cover" or screensaver_type == "cover" or screensaver_type == "random_image" or
G_reader_settings:readSetting("screensaver_type") == "random_image" or screensaver_type == "image_file" then
G_reader_settings:readSetting("screensaver_type") == "image_file" then
if not G_reader_settings:isTrue("screensaver_no_background") then if not G_reader_settings:isTrue("screensaver_no_background") then
self.screen:clear() self.screen:clear()
end end

Loading…
Cancel
Save