| Summary: | Android: creation of multiple SDL_window | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain <sylvain.becker> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | don't know | ||
| Hardware: | All | ||
| OS: | Android (All) | ||
| Attachments: |
demo app
prototype patch |
||
|
Description
Sylvain
2020-06-04 11:39:24 UTC
Created attachment 4368 [details]
demo app
This is a small demo app, that creates/deletes SDL_Window and just render a blinking screen and a cursor on each.
Press two fingers at each corner, to create-delete a window.
The first created window is red, created from the top-left.
You can create/delete from the other 3 corners.
Created attachment 4369 [details]
prototype patch
This is an unfinished patch. most secondary features are not tested, and it has bugs for sure.
It shows we can create several SDL_Window, each one has its own activity and SurfaceView.
Due to the nature of Activity that are "stacked" on a phone, the SDL_Window are also stacked when used on a basic phone. And it's not possible to re-order the stacked composed of several instance of the same activity. (though, it's possible to re-order several different activities).
On a phone that started the multiwindow mode, it's possible to have two window adjacent. But multiwindow isn't meant to be activated by the application. So it's not really useful.
On a chromebook. I don't have one and I simply tested it with the emulator and it indeed creates several windows. This case seems interesting. The emulator isn't really stable, so it's hard to tell more...
A phone with several screen: not tested / don't have one neither.
Some points with the patch:
- SDLWindowActivity class it for creating SDL_window.
- SDLActivity remains to start the SDL thread. this isn't convenient to have this activity ... Android has also "service" class, but it's doesn't create a icon to launch the app ...
-> what is bad is that there is a glitch transition from SDLActivity to the first SDLWindowActivity, which seems unnecessary.
- after multiple/stress creation/deletion of window, there are issues with backup-restore of egl context, not sure when it comes from ...
Some other point:
- I wonder whether starting a SDL_Window in a new instance of activity is a good choice, maybe it should be run in what android call "fragment" ?
Conceptually in SDL all the windows are in a single activity. I don't know how Android represents multiple windows and whether this is a requirement of the system, but it seems worth exploring. |