Currently SDL can run in multi-window, you can resize the window, share the screen with another app, get/lose focus, etc. Indeed it doesn’t allow to create more than one window.
Once, I tried to patch SDL to create several pseudo windows by simply creating several surfaceView, so that windows were in fact “layers”, z-ordered. This worked, but this wasn’t representative of SDL functionnalities.
It should be possible to create several genuine windows with several activities.
Currently SDLActivity creates surfaceview, and when all is ready, starts the C main.
With several windows, it’s going to be a little bit messier, with some re-factoring needed.
A compromise for simplication could be to have a master window (the root activity), and several other.
That would be great, especially knowing that genuine windows can take advantage of Android’s features designed for windows, such as system-wide drag&drop (which is another feature in scope of SDL and worth considering).
What would happen if the user closed the master window in that case?
What parts of SDL do you think would be involved in such refactoring? Is it a lot of work?
I tried to patch SDL2 for allowing the creation of multiple SDL_Window on Android.
Each one in a new activity, with no root activity limitation.
This is an unfinished patch. most secondary features are not tested, and it has bugs for sure.
But you can find the patch here: https://bugzilla.libsdl.org/show_bug.cgi?id=5173
Thank you! It’s amazing how fast this went from a discussion to a working prototype. Looks interesting!
I won’t be able to test it for the next couple of weeks, unfortunately, but definitely will do later.
Also, I want to comment on this bit:
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” ?
AFAIK, there is no other option besides using 1 activity per SDL_Window.
Consider the freeform mode on Android: