[SDL] Separating Window Management from Display Surfaces

Edward Cullen eac203 at ecs.soton.ac.uk
Sat Jun 14 11:08:35 PDT 2008


Hi,

Started looking at ParaGUI recently. Having noted that there is no 
support for SDL 1.3, I started looking into what would need doing.

Along the way, I noticed that there is no strict separation of window 
management and display surfaces within SDL. This is particularly 
apparent when one starts to use OpenGL, which as no concept of window 
management.

Now, on traditional (desktop) systems, ordinary drawing surfaces seem 
intrinsically linked to the notion of windows and window management; on 
Win32, an SDL drawing surface is analogous to the 'client area' of a 
window, while on X11, the smallest 'visible' primitive is a window.

On many other platforms (e.g. svgalib) there is simply no concept of a 
window at all.

For tradition systems, there is also the question of integration of SDL 
drawing surfaces into fully-featured widgets sets/window managers (GTK+, 
Qt etc).

By separation, I mean something like (pseudo code):

<code>

SDL_surface *disp = SDL_CreateDisplaySurf().

if (system_has_wm()) {
   SDL_window *win = SDL_CreateWindow(disp);
}

if (system_has_wm()) {
   // Set window to fill screen "Maximise"
   SDL_FullScreenWindow(win);
} else {
   // Set surface to fill whole screen
   SDL_FullScreenDisplaySurface(disp);
}

</code>

Questions:

1. Is the current state a result of expedience vs. rigour in early 
designs (i.e. it wasn't really an important issue when SDL started), or 
is it a concious reflection of the practicalities of some underlying 
systems?

2. Would the following benefits be realisable if a more strict 
separation of window management were implemented?

   a. Reduced library overhead on non-windowed systems (e.g. svgalib).
   b. Improved consistency of concepts between windowed/non-windowed
      systems.
   c. Improved ease of integration with other GUI libraries (e.g. GTK+).
   d. Improved consistency of concepts between OpenGL surfaces and
      ordinary SDL surfaces (and other surfaces).
   e. Reduced complexity of implementing multi-window support on windowed
      platforms.

Jitsu love,

Eddy




More information about the SDL mailing list