-
-
Notifications
You must be signed in to change notification settings - Fork 938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear ongoing taps when going to sleep #2108
Conversation
Build size and comparison to main:
|
Also fixes #1992 |
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 |
I would avoid any UB. |
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 |
I think the perfect type of that function would not be Otherwise return always |
Excellent idea, optional makes perfect sense here semantically. I will try it out |
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. |
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 |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes look sound, not tested on PineTime
Cleaned up the OnTouchEvent method as it was just an alias for PushMessage after Unify touch handling, no other changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Tested on my pinetime, works fine!
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)