[SDL] Windowed mode functionality

Steven Brown swbrown at ucsd.edu
Tue Jul 2 22:39:00 PDT 2002

Hello, I'm trying to get SDL to let me do windowed 3D the way I'd like it to 
be done and I'm running into a few problems.  I'm pretty sure they'll require 
making modifications to SDL, so I'm emailing to see if the missing 
functionality / bugs I'm looking at really are missing functionality / bugs, 
and if my plans sound like the right thing to do to you.  Any advice would be 
appriciated!  I'm aiming to get these things working on both win32 and Linux 
(KDE/GNOME) so my app can provide a spiffier windowed mode on those 

- My window needs to start up maximized and the resulting window size needs to 
be known.

I'm not sure of the right way to do this, but a hack in X is to create the 
window of size 4096x4096 and it results in it being properly maximized in X 
at least (haven't tested Windows yet).  The problem is that the SDL surface 
reports being size 4096x4096 even though the window wound up much smaller 
than that.  It takes a resize event occuring before SDL will return the true 
numbers.  I know xwininfo can get the right information, so I'd probably just 
need to fix SDL_SetVideoMode to do the same query for the real width and 

- To handle window resizing, when SDL gives me a resize event, I do 
SDL_SetVideoMode to change the width and height.  This has a side-effect of 
clearing the 'maximized' state of the window in X, at least for KDE3.

I assume that's either me not using the correct method to handle a resize 
event, a bug somewhere underneath SDL's SDL_SetVideoMode, or a bad SDL->Kwin 
interaction.  If there's nothing wrong with my method, I figure it'd just 
take a bugfix or workaround under SDL_SetVideoMode.

- I need to be able to detect if my window is set 'maximized' vs. just large.

In Windows, I hear this is done via win32's 'IsZoomed()'.  In X, the 
'standard' (accepted :)) way I believe is if there are 
_NET_WM_STATE_MAXIMIZED_* properties on the window.  If there's not a better 
way, I could add some sort of 'isMaximized' function to SDL's WM stuff to 
test these.  As far as my app is concerned, it gest a SDL_VIDEOEXPOSE event 
in X when the maximized state is toggled even if the window size doesn't 
change, so I'd then just need to do the isMaximized check in my expose 
handling code to be notified when the maximized state of my window changes.

More information about the SDL mailing list