GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — Clear ongoing taps when going to sleep by mark9064 · Pull Request #2108 · InfiniTimeOrg/InfiniTime Conversation
Member
Currently if the touch panel is pressed when DisplayApp goes to sleep, the finger up event gets dropped. This causes LVGL to think the finger is never released from the touch panel, so it prevents the device from sleeping. This PR clears the tapped state when going to sleep so the internal LVGL state remains consistent with the real touch panel state. Fixes part of #1790 #2012 (there may be other issues contributing to these, but this is probably part of it)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
Build size and comparison to main:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Also fixes #1992 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Actually the same problem exists with TouchHandler. Should we clear the tap state there too? Or do we define calling its methods as UB when the touch panel is sleeping (as when it's sleeping, it's not possible to know whether the screen is touched or not) TouchHandler doesn't cause any bugs, but it could certainly in the future. If we choose to define it as UB then we should guard // DisplayApp.cpp if (touchHandler.IsTouching()) { currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY()); } with a state == Running check |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I would avoid any UB. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I mean defining calling the methods as UB by documentation i.e the documentation for the function IsTouching() saying "if the device is sleeping, the value returned is undefined". There is no UB C++ spec wise |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I think the perfect type of that function would not be Otherwise return always |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Excellent idea, optional makes perfect sense here semantically. I will try it out |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I think we could just clear the tap in TouchHandler as soon as the touch panel is sleeping as well, since I don't think we want to handle touch while the device is sleeping. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
24f0c6d to
167382d
Compare
|
So this has turned out to be a bit trickier than I thought. TLDR the touch panel still delivers events when sleeping, so trying to pretend it doesn't with TouchController having a null state is incompatible with double tap wake / tap wake. So instead I've opted to unify the touch processing into something a little more sensible, so the TouchController always has up to date touch state even when the device is sleeping. So the original problem is addressed with DisplayApp not receiving or processing any touch events while sleeping, and clearing touch state on sleep entry |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Add function `LittleVgl::ClearTouchState` introduced with InfiniTimeOrg/InfiniTime#2108 As it is a new function the change is compatible with current v1.14.0-dev state (`main` branch of InfiniTime)
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
changes look sound, not tested on PineTime
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Cleaned up the OnTouchEvent method as it was just an alias for PushMessage after Unify touch handling, no other changes |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Tested on my pinetime, works fine!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.