Implement auto-suspend function for Kobo. Add test case for UIManager:_checkTasks, which should not clear _task_queue_dirty bit before looping.

This commit is contained in:
Zijie He
2016-03-18 16:33:14 -07:00
committed by Zijie He
parent ad2ccc995e
commit b86aa5a02b
4 changed files with 75 additions and 5 deletions

View File

@@ -251,9 +251,18 @@ function Input:handleKeyBoardEv(ev)
end
end
if ev.value == EVENT_VALUE_KEY_RELEASE
and (keycode == "Light" or keycode == "Power") then
return keycode
if ev.value == EVENT_VALUE_KEY_RELEASE then
if keycode == "Light" then
return keycode
elseif keycode == "Power" then
-- Kobo generates Power keycode only, we need to decide whether it's
-- power-on or power-off ourselves.
if self.device.screen_saver_mode then
return "Resume"
else
return "Suspend"
end
end
end
-- handle modifier keys