-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
LCD Overlay use by multiple apps #3417
Comments
Thanks - overwriting Rather than hacking around this, maybe it's best if we just make Potentially it's not the end of the world to update the draw function to handle multiple overlays at once? It'll be a bit slower but it won't be a big deal: https://github.com/espruino/Espruino/blob/master/libs/graphics/lcd_memlcd.c#L292-L295 |
Allowing multiple overlays is not a complete solution. Apps that show an overlay and manipulate global state need to be informed if they are currently on top or not. Multiple overlays multiplies the problem of dealing with touchscreen event handlers that were present before opening the overlay. I think keeping it simple with one allowed overlay and just assuming that any overlay could be a "modal" one highjacking all handlers should cover most usecases. |
I can see both use cases - say there's a modal overlay ( I suppose we'd still need a priority / z-order so the firmware knows which to draw last, so perhaps fully modal would be good as an initial approach. Looking at Whereas |
Ok, well, it saves me work if you don't want multiple overlays :) I guess I'm a bit concerned that In the openstmap case, using setLCDOverlay seems like the wrong solution. The contents of the screen that's overwritten could be copied back into a small buffer before drawing the icon and overlays could be avoided completely. That would IMO be preferable to having the overlay and then also a fallback - it's likely faster and more efficient for rendering too. I'll see about making that change. My real concern here is we're trying to deal with an issue which occurs reasonably rarely even with non-standard apps installed, but we'll be introducing more code that may end up running and slowing down every user's Bangle all the time. So really the question is how we implement this in such a way that it's not going to slow everything down when it's not used.
But just for a second, can we assume that we extend
Are there any cases where this would actually be a massive problem? It seems like:
If this works, adding it could hopefully be done without really adding any more bloat. |
Maybe off-topic, but: |
miseler yes, it's definitely something that'd be pretty easy to add with setLCDOverlay right now. It could be a pretty simple app to add. |
That is a very KISS solution and probably removes 95% of problematic cases. I think that would be enough for me. The remove callback is essential for apps that use overlays to clean up their stuff to prevent breakage in other apps. Maybe that even allows implementing more fancy handling of overlays on top of that if somebody really wants to do that in a library/boot code. The whole input/handler/watches part should be done in a separate library anyway for apps that actually want that complexity. Do files on storage have priority over modules in an app? If so we could reduce |
Yeah the separate library for more complicated use sounds good, same for an app for |
Ok, cool - before I do this can you think if there's anything in that 5% that's going to be a nightmare? To try and make this backwards compatible, I could extend it to:
At least then it's a bit more extensible, and on older firmwares they'll just ignore the callback?
Sadly I think it's the other way around. I guess we would need to make a new app for 'swipe on widgets' and then have all apps/clocks that do it modified to use that. Then widget_utils could be reduced to just show/hide as it was before? |
I can only think of situations where the UX is suboptimal in case multiple apps want to use the overlay. As long as the remove callback is correctly called it should at least all work in a defined way at all times with this solution. What about introducing this as a polyfill to the bootloader app and using it a while before promoting it to firmware? That would allow to change the API without many concerns for backwards compatibility in firmware. I have played around with your proposal a bit but did not test on hardware yet, just the emulator: https://gist.github.com/halemmerich/631d226e393e1d10da5ac1b47e025cab |
… onRemove:fn} to deal with multiple users of overlays better espruino/BangleApps#3417
That sounds like a good plan, yes. However I'm planning on releasing a 2v22 firmware pretty soon, so in a way if I'm going to do it I'd rather get something built in before that (or it'll be a few months until the next one). I've just added some code to the cutting edge firmware, so this should hopefully all work now. Only thing I changed from above is Please can you have a try with it and see if that's all working ok for you? |
I have found a potential problem with how Do we want the app handling that or maybe just not call the remove handler if the The app could differentiate because it knows if it called to remove or to set an overlay, but I have a tendency to solving that in Another small nitpick, the option is called |
Thanks - good point. Maybe we just don't call it if we're updating the overlay - and I'll change it to |
Just done |
Great, thanks, I'll adapt my code and have a try. |
I have tested removal of the Edit: A short test with 2v21 was successful as well: clock->swipe down widgets->show message->swipe down widgets again->fastload to launcher |
Great, thanks! Just looking at these changes, are you sure we need the overlayRemoved logic? It feels the only time it's needed is if something else displays another overlay during the short swipe animation, so that it doesn't get removed. ... but even then, it seems like cleanupOverlay gets called by the remove handler, and that clears animInterval which was the place where you check overlayRemoved - so it feels like the exports.overlayRemoved check in queueDraw will always return false? |
No, we don't need that. Resetting the offset at all relevant places and depending on that to determine if the overlay should be enough. |
…On to literally never be hidden. Was introduced as part of #3417 (comment)
…On to literally never be hidden. Was introduced as part of espruino#3417 (comment)
Affected hardware version
Bangle 1, Bangle 2
Your firmware version
2v21
The bug
Continuing the conversation from #3394 (comment)
The default priority is a nice idea, perhaps we could manually trigger
Bangle.on("overlayReplaced", ...)
handlers handles too, to allow the above code to be a bit less disruptive.@gfwilliams any thoughts?
Installed apps
No response
The text was updated successfully, but these errors were encountered: