[SDL] Re: Multiple SDL Windows again...

Ryan C. Gordon icculus at linuxgames.com
Sun Apr 29 16:59:05 PDT 2001

> Well, in many cases this would be OK - but only until the
> popup menus get sufficiently big so that they have to
> extend beyond the borders of the window - or if, say,
> the window is at the bottom of the screen and you
> need to popup the menu upwards instead of downwards
> to be able to see it. So the only solution which is
> general enough is a new window for each popup-menu...

Assuming that the EXTRAWINDOW flag is a viable approach to extending SDL
(I'll leave that to Sam to comment upon), then what you would want to do
is something like how Java's Swing class does it.

You have a few HEAVYWEIGHT windows: top level, framed windows, popups and 
pulldown menus, etc. Each of these is a SDL surface created with this
hypothetical EXTRAWINDOW flag.

Every thing else is a LIGHTWEIGHT window. They can be offscreen surfaces,
or whatever, but their only physical representation is when it is rendered
inside a heavyweight window. This means you need to manage rendering
overlap of lightweights, and catch mouse/keyboard/etc events on the
heavyweight and see that they make it to the correct lightweight

This IS doable. With something like EXTRAWINDOW, it could even be done
with SDL.

The question though, is what would be the worth? There are UI kits for SDL
(although they don't allow popups past the edge of the screen surface,
etc) if you just want some basic UI functionality. There are portable
solutions (gtk, Qt, wxWindows, Swing) if you want that.

If you just want to tinker, the heavyweight/lightweight approach would be
fun to code, but would be a lot of work for (again) something of less
pratical value than it should be worth.



More information about the SDL mailing list