[SDL] Bug in SDL_resize.c

gtxayf1q001 at sneakemail.com gtxayf1q001 at sneakemail.com
Mon Sep 2 12:03:01 PDT 2002

int SDL_PrivateResize(int w, int h)
  int posted;
  SDL_Event events[32];

  /* See if this event would change the video surface */
  if ( !w || !h ||
    ((last_resize.w == w) && (last_resize.h == h)) ) {
This part seems fine.        
  last_resize.w = w;
  last_resize.h = h;
  if ( ! SDL_VideoSurface ||
     ((w == SDL_VideoSurface->w) && (h == SDL_VideoSurface->h)) ) {
  // Proceed to post SDL_VIDEORESIZE

But this is wrong. Consider creating a resizable window of 
given size, for example:

SDL_SetVideoMode(400, 300, 32, SDL_OPENGL|SDL_RESIZABLE);

We'd like to get SDL_VIDEORESIZE every time the size of the
window is changed. But, since SDL_VideoSurface never changes,
we'll always compare the new size to (640, 480) before
posting the message.

The effect is clearly seen when just maximizing the new 
window and then restoring it - we'll get SDL_VIDEORESIZE
for the max, but not for the restore.

More information about the SDL mailing list