title: Handling maximized windows using SDL
body: <p>We recently ported <a href="http://bitfighter.org" rel="nofollow">Bitfighter</a> from GLUT to SDL.  There were numerous benefits to doing this, but a few drawbacks as well, especially in the area of window management. </p>
  
  <p>Bitfighter runs in a fixed-aspect-ratio window (800x600 pixels).  Users can make their window any size they want, but we capture the resize event and make adjustments to the requested size to ensure the window keeps the correct proportions (using SDL_SetVideoMode).</p>
  
  <p>(The following problem applies to Windows, but has not yet been tested on other platforms.  What I describe below refers specifically to Windows, though I am looking for a platform-independent solution.)</p>
  
  <p>Ordinarily, this works great, except when users maximze their window by double clicking on the title bar or using the maximize button.  In that case, the window resize event is called with the a window size approximating the screen size (minus some pixels for window ornamentation).  Unfortunately, when the window is maximized, SDL_SetVideoMode has no effect (unlike GLUT which was able to resize a maximized window).  Furthermore, subsequent calls to SDL_GetVideoInfo report the size we requested, not the actual current size of the window, so it is hard to tell if the attempted resizing worked.</p>
  
  <p>I am looking for a platform independent way to do any of the following (in descending order of preference):</p>
  
  <ol>
  <li>Resize a window after it's been maximized</li>
  <li>Detect when a window has been maximized so that, knowing I can't resize it, I can at least adjust the video to be centered</li>
  <li>Prevent a window from being maximized (block double clicks on window title bar, use of the maximize button, and dragging the window to the top of the screen)</li>
  </ol>
  
  <p>Bitfighter is written in C++, and we're using the latest official release of SDL.</p>