ScreenSaverLock: Hide the popup on suspend (#11174)

Fix #11164 and involves a drive-by fix:

Kindle: Send Suspend/Resume event regardless of the screen saver state

If we get the events, it means stuff happened, we can't just only honor
it in the most common workflows ;).

This effectively reverts a tiny bit of #10426 (I was sort of expecting
this to be problematic at the time, and I most likely hadn't tested it).
This commit is contained in:
NiLuJe
2023-11-29 00:15:50 +01:00
committed by GitHub
parent 33c7f05158
commit 4a64e02c68
3 changed files with 22 additions and 7 deletions

View File

@@ -297,9 +297,9 @@ function Kindle:intoScreenSaver()
-- so that we do the right thing on resume ;).
self.screen_saver_mode = true
end
self.powerd:beforeSuspend()
end
self.powerd:beforeSuspend()
end
function Kindle:outofScreenSaver()
@@ -350,9 +350,9 @@ function Kindle:outofScreenSaver()
-- Flip the switch again
self.screen_saver_mode = false
end
self.powerd:afterResume()
end
self.powerd:afterResume()
end
function Kindle:usbPlugOut()

View File

@@ -801,9 +801,8 @@ function Screensaver:close()
-- that we've actually closed the widget *right now*.
return true
elseif screensaver_delay == "gesture" then
if self.screensaver_lock_widget then
self.screensaver_lock_widget:showWaitForGestureMessage()
end
-- ScreenSaverLockWidget's onResume handler should now paint the not-a-widget InfoMessage
logger.dbg("waiting for screensaver unlock gesture")
else
logger.dbg("tap to exit from screensaver")
end

View File

@@ -29,6 +29,8 @@ function ScreenSaverLockWidget:init()
self.ges_events.Tap = { GestureRange:new{ ges = "tap", range = range } }
end
end
self.is_infomessage_visible = false
end
function ScreenSaverLockWidget:setupGestureEvents()
@@ -100,6 +102,9 @@ function ScreenSaverLockWidget:showWaitForGestureMessage()
infomsg:paintTo(Screen.bb, 0, 0)
infomsg:onShow() -- get the screen refreshed
infomsg:free()
-- Notify our Resume/Suspend handlers that this is visible, so they know what to do
self.is_infomessage_visible = true
end
function ScreenSaverLockWidget:onClose()
@@ -129,10 +134,21 @@ end
-- NOTE: We duplicate this bit of logic from ScreenSaverWidget, because not every Screensaver config will spawn one...
function ScreenSaverLockWidget:onResume()
Device.screen_saver_lock = true
-- Show the not-a-widget InfoMessage, if it isn't already visible
if not self.is_infomessage_visible then
self:showWaitForGestureMessage()
end
end
function ScreenSaverLockWidget:onSuspend()
Device.screen_saver_lock = false
-- Drop the not-a-widget InfoMessage, if any
if self.is_infomessage_visible then
UIManager:setDirty("all", "full")
self.is_infomessage_visible = false
end
end
return ScreenSaverLockWidget