Add screen lock functionality, unlocked by pressing both forward and back buttons simultaneously #341
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I have a waterproof Kobo Libra H2O. In the rain or shower, water generates touch events on the screen. I want a way to disable these temporarily and only use the buttons.
The functionality is accessible inside the reader, select the top bar and select "Lock Screen Input". Then the screen is disabled, but you can still navigate using the buttons. Pressing them together unlocks the screen.
Core Organization
Most of the code is implemented in the top level plato and emulator apps. The code is duplicated, so I'd appreciate advise on where to put them. I added a
LockScreenInput
event, which sets a boolean, and then sendsEvent::Toggle(ViewId::TopBottomBars)
.When the boolean
is_screen_locked
is set, then all Gesture events are caught and skipped. Lmk if this is the correct way to do this.Apart from that, there's a bit of logic to handle pressing both buttons together.