Proposed window management extensions [Please Read]

Well, while we’re on the subject of extensions that don’t make it into
reality, here are my proposed set of extensions for extending SDL’s Window
Management subsystem, which I will hopefully be able to hack on during my up
and coming Spring Break after my Gama Sutra bubble blowing kit that I picked
up at GDConf runs out of fluid. I had forgotten how fun that stuff could be.

Some of this is old material.

The basic design that I have come up with is designed to maximize compliancy
with the already existing SDL code, while trying to extend it. It works kind
of like… well, the closest “metaphor of sorts” that I can think of is the
GL multitexture ARB extension, where you pick a TMU and then choose
properties for it, then go to the next one, etc.

For every window generated, you get a “Window Context”, with an associated
surface inside. Window Contexts are structures.

New functions are:

SDL_WindowContext *SDL_WM_CreateWindow – allocates a new window and returns
a window context, including a surface for drawing on, based on these
specifications. A flags bit will also be passed, indicating whether the
window can grow, shrink, and a few other things. (Basically straight from
GTK+ for max. compatibility) Window contexts automatically become active
after creation; this is necessary for easy compliancy with prior SDL code,
so that you can generate a window using SDL_SetVideoMode and still grab a

Fullscreen modes will have a context associated with the backdrop screen
too. However, note that there are some internal flags set to warn SDL that
this is a fullscreen context. Window Contexts can be allocated in fullscreen
modes. They will automatically dump to the currently selected video mode
surface during a flip call.

SDL_WindowContext *SDL_WM_GetCurrentWindowContext – gets the currently
active window context.

void SDL_WM_SetCurrentWindowContext (SDL_WindowContext *foo) – sets it. :slight_smile:

SDL_Surface *SDL_GetVideoSurface ( void ) – since we’re now keeping a copy
of it, we may as well use it. This is mainly a way of accessing the current
window context surface without directly accessing the internals of the
WindowContext structure. Although this may be both a bad and good thing.
(Mass murder on structs! Fun!)

The following functions have changed behaviour:… (hang on while I dredge
up my API list! bang klunk tinkle… ah):

SDL_Flip() – actually flips the target buffer into the buffer associated
with the current window context and then redraws the window.

SDL_SetVideoMode() – generates a new window context based on the
appropriate flags, will initialize video mode if a fullscreen mode, and
returns the surface (making the newly generated window context the current
window context)

All current SDL_WM functions refer to the current window context.

One question I have unresolved, and there will be others, is the best way to
handle double buffering. Can we double buffer for multiple windows? (Does
SDL currently double buffer at all?!) There’ll also be a few fun surprises
involving OpenGL and integration of all this crap.

We will also need some sort of artificial emulation mode for fullscreen.
Understand that SDL Windows, unless implicitly specified, act like … oh

OK: What I was going to say is, Act in a way conducive to GDK overlays.
(I.e. we don’t actually generate title bars). Now (A) I can’t remember if
GDK actually DOES this, or if I’m just imagining things. Regardless, OK: we
need to have a flag in SDL_WM_CreateWindow to indicate whether or not we
display with a window manager compliant title bar. (I think you can override
it and tell it not to… just can’t remember right now. And I can see a lot
of other situations, regardless of GDK, where it’d be useful to have windows
w/o title bars. Drag around toolbars, for instance.

Anybody have any thoughts, or volunteers to do the MacOS/Be versions if I
get the base code and Linux X implementation up?

And how do you get bubbles out of a floppy drive? :slight_smile:


Nicholas, with a very clean carpet floor–
Nicholas Vining “While you’re out there struggling
vining at with your computer, I’m naked,
icq: 20872003 clueless, and feeling good!”
- Ratbert