Future windowing support

I’m curious as to the developement state of windowing in SDL. I have a
few questions about where this is headed, and if any of the directions I
am hoping for are possible then I would like to help get SDL there quicker.

Firstly, the fullscreen issue. Are there any plans to fix the fullscreen
toggle issue? That is, it not working on some systems. I realize the
problems currently are:

  • The current syntax is impossible to implement on many Windows
    operating systems
  • SDL_WM_ToggleFullScreen() can not be changed, as this breaks any code
    using the bad version.
  • SDL_WM_ToggleFullScreen() can not be overloaded to a better version,
    do to limits of the C programming language.

I have two ideas for fixing this:

  1. change SDL_WM_ToggleFullScreen() to return an SDL_Surface pointer.
    Old code will ignore the returned value, but that would be depreciated
    while using SDL_WM_ToggleFullScreen() and then using the returned
    surface (which may be the same one that was passed to it) would be the
    new standard.
  2. If that would break anything, then more functions will have to be
    created, but I can’t think of how do to that without causing much confusion.

Although, I now think of something interesting: perhaps this is a bad
function to begin with. What if the window is an invalid size? The
fullscreen would be pointless. Also, its wasteful to resize a window and
then make it fullscreen to get the size you want. Very likely,
SDL_WM_ToggleFullScreen() should stay hidden forever.

Secondly, the issue of multiple windows. Support for this is essential
for SDL to be widely adapted, as it should be. Of course, the current
design makes this fairly difficult to implement. The current WM
functions must stay as they are, and thus multiple window support must
be done entirely be a new set of functions. Here is what I have in mind:

A new struct, SDL_Window, needs to be created. This would have a pointer
to the windows surface structure and would store the title of the
window, etc. Three functions, in conjunction with this, will allow
multiple windows to be supported in SDL:

SDL_Window* SDL_WM_CreateWindow(void)
int SDL_WM_UseWindow(SDL_Window*)
int SDL_WM_DestroyWindow(SDL_Window*)

The first function creates a new SDL_Window structure, which is
internally registered with SDL. Only registered SDL_Window structures
can be used with the second and third functions.

Then SDL_WM_UseWindow() is called, if the passed window structure is
registered with SDL, then any functions which normally affect the single
SDL window will affect this, “in use”, window. Thus, the old functions
can remain unchanged, and multiple windows support can be very possible.

SDL_WM_DestroyWindow() will, obviously, unregister a window and close it.

It might also be useful to have other window functions, such as hidding
and displaying the window (without destroying and creating it), and
window positioning would be very very nice.

Thank you for taking the time to read my rant.

Although, I now think of something interesting: perhaps this is a bad
function to begin with. What if the window is an invalid size? The
fullscreen would be pointless. Also, its wasteful to resize a window and
then make it fullscreen to get the size you want. Very likely,
SDL_WM_ToggleFullScreen() should stay hidden forever.

I don’t use SDL_WM_ToggleFullScreen exactly for the reasons you mentioned.
SDL_SetVideoMode is a better interface than SDL_WM_ToggleFullScreen, it just
needs cleaning up. SDL_WM_ToggleFullScreen should just be a shell around
SDL_SetVideoMode. There’s no sense having two internal pathways for doing
the same thing, they will just develop two different sets of bugs.

Secondly, the issue of multiple windows…

Ah yes, and windows not created by SDL.

Regards,

DanielOn Saturday 25 January 2003 16:51, Calvin Spealman wrote: