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).
reviewable/pr11182/r1
NiLuJe 5 months ago committed by GitHub
parent 33c7f05158
commit 4a64e02c68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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()

@ -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

@ -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

Loading…
Cancel
Save