[SDL] Driver question

Maxim Sobolev sobomax at FreeBSD.org
Mon Jan 22 10:11:23 PST 2001


Thu, 04 Jan 2001 sondheim at knxmail.com wrote:
> > hi,
> > 
> > is it possible to open more than one window within an application using the sdl?
> > 
> > cheers, timo
> 
> No... Bare in mind that many SDL targets (like fbcon, alib,
> and svgalib) don't have a concept of a window, so "opening
> multiple windows" doesn't make any sense... Since the goal
> is to have sdl work pretty-much the same on all targets,
> the ability to open mutilple windows with the current API
> wouldn't be a good thing. 

Good point, but I think SDL is too useful in windowed, non full screen
applications to ignore this possibility.


> The ideal way to do this [imho] would be to expose this in
> the API as a property of a target's video-capibilities,
> (does a target support non-fullscreen operation?) and have
> the abaility to go fullscreen either depricated, or disabled
> when multiple SDL windows are open:

Yes. (The information would be useful in some other cases as well. For
example, you don't need custom window decorations in full screen mode, do
you...?)


> *THEN*
> 
> Have a thin windowing library that sits on top of SDL (that
> allows nesting of sdl surface windows inside of sdl surface
> windows, and so forth like on any windowing system.  This
> thin library could then, on systems with non-fullscreen
> capibility, provide an option to not own the root window,
> (whereby drawing to the root window was either ignored
> or emulated on the windowing system's background) and
> all top-level windows of the root would be their own
> windowing-system windows.

I like that. :-)


> *THE RESULT:*
> You could write an application for the thin windowing
> library, and on targets that didn't have a windowing
> system, it would work fullscreen, while on windowing
> system each top-level window would have it's own window
> (at least as an option)... with almost no application code
> aware of the difference.  Meanwhile, existing SDL code
> would continue to work supporting both full-screen, and
> windowed operation.
> 
> *THE CHALLENGE*
> Although "thin windowing libraries" like I discussed have
> been written (thousands of times over all around the world)
> writing one is still no small task, and without one,
> multi-windowed SDL apps would have to bend over backward
> to work on fullscreen-only targets.

The "Default SDL Window Manager"...

Should be themable in one way or another to be of much use for serious work,
especially when dealing with games and other entertainment software. The
easiest way is probably to base the toolkit on "logical" widgets (ie widgets
that don't render anything visually), and then allow applications to hook in
their own rendering code.

Of course, the custom window decorations could work in windowed mode as well,
by using borderless windows, and still use the SDL window manager.


> *THE CHALLENGE*
> Although "thin windowing libraries" like I discussed have
> been written (thousands of times over all around the world)
> writing one is still no small task, and without one,
> multi-windowed SDL apps would have to bend over backward
> to work on fullscreen-only targets.

Yep...

Is there any common (and preferably very thin) layer of functionality that most
of these libraries could use? Integrating that into SDL could save lots of work
and provide a wider choice of window managers, as opposed to hacking a new
window manager right into SDL.

Basic management of windows (just surfaces that are actually rectangular areas
on top of the root surface) should do, I think. (A window with SDL/application
rendered decorations would simply be a surface with a smaller surface on top of
it, representing the full window size and the client area, respectively.)


//David

..- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
..- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david at linuxdj.com -'



More information about the SDL mailing list