OK, going back to the GTK+ thread, I started to think and rattle this through
my brains again, and one of the things that came up was how nice it would be to
have some way of doing this. The key problem, IMHO, is the window issues. Yeah,
writing a system to extend SDL to support “multiple windows” is … fairly easy
… (easier for application development environments where you have a window
manager than those where you do not…), but the problems are (A) making it
nice, and (B) integrating backwards compatibility. So, how about something like
this… see what you think of my proposal.
Windows are defined, created, and resized with a Window Manager function. Each
Window has a surface on it, automatically tuned to the width, height, and depth
of the window, which you can define manually. The SDL_video functions become
wrappers to these functions, creating a window as needed or kicking into
fullscreen mode as needed, and toggling flags indicating that if the user
wishes to spawn a secondary window, it will need to be done on the main buffer.
Somewhere behind this is another layer of code, which actually handles the
drawing aspects, and in between that you have the layer which will emulate a
windowing system, if one is requested and not found (if you’re runnning in
fullscreen svgalib/fbcon mode)
SDL drawing functions, by default, would draw to the currently selected window.
The key one here is SDL_Flip, as well, I suppose, as SDL_GL_SwapBuffers… and
all the SDL_WM functions. You change your window by hitting
SDL_SetTargetWindow(), and pass it a pointer to a window structure that you’ve
requested from somewhere… and you get the idea.
The internals seem moderately ugly to me as a programmer, and could only serve
to convolute things, but the outside is nice and simple to use, and it
maintains backwards compatibility, which, for me, is a big priority. This also
means a great big whacking SDL rewrite spree, which could take a while.
Thoughts?
Nicholas
NB: Yes, SDL will run on Cr