SDL_WINDOWID problems

Hi,

Since I upgraded to the latest SDL version (1.1.3) I’ve been having
problems using the SDL_WINDOWID hack, I get this message when I try to
call SDL_SetVideoMode ():

Gdk-ERROR **: BadWindow (invalid Window parameter)
serial 33 error_code 3 request_code 2 minor_code 0

And after that the program exits, I can’t even make the gtk-demo work
anymore (everything was fine before I upgraded). Does anyone have any
ideas or is it a bug in SDL ? If I don’t use the SDL_WINDOWID hack the
program works but I get the SDL display in another window.

Leonardo

Sorry, it was indeed my fault. The patch below should fix it (though I have
not tested it on strange visuals yet). Sam, please apply it and accept
my apologies.

Cheers,

Mattias.

diff -u -r1.6.2.39 SDL_x11video.c
— SDL_x11video.c 2000/03/22 18:12:09 1.6.2.39
+++ SDL_x11video.c 2000/04/03 17:46:08
@@ -338,6 +338,12 @@
return(-1);
}

  •   /* allow for easier debugging (get errors when they happen) */
    
  •   if(getenv("SDL_VIDEO_X11_SYNC")) {
    
  •       XSynchronize(SDL_Display, True);
    
  •       XSynchronize(GFX_Display, True);
    
  •   }+
      /* Set the normal X error handler */
      X_handler = XSetErrorHandler(x_errhandler);
    

@@ -394,7 +400,7 @@

    if ( SDL_windowid ) {
            FSwindow = 0;
  •           WMwindow = atol(SDL_windowid);
    
  •           WMwindow = strtol(SDL_windowid, NULL, 0);
      } else {
              create_aux_windows(this);
      }
    

@@ -483,6 +489,12 @@
return -1;
vis = vi->visual;
depth = vi->depth;

  •   } else if( SDL_windowid ) {
    
  •       XWindowAttributes a;
    
  •       SDL_Window = strtol(SDL_windowid, NULL, 0);
    
  •       XGetWindowAttributes(SDL_Display, SDL_Window, &a);
    
  •       vis = a.visual;
    
  •       depth = a.depth;
      } else {
          for(i = 0; i < this->hidden->nvisuals; i++)
              if(this->hidden->visuals[i].bpp == bpp)
    

@@ -560,9 +572,7 @@
}

    /* Create (or use) the X11 display window */
  •   if( SDL_windowid ) {
    
  •           SDL_Window = atol(SDL_windowid);
    
  •   } else {
    
  •   if( !SDL_windowid ) {
              if ( flags & SDL_OPENGL ) {
                      if ( X11_GL_CreateWindow(this, w, h) < 0 ) {
                              return(-1);
    

@@ -590,8 +600,10 @@
}

    XSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap);
  •   XSetWindowColormap(SDL_Display, FSwindow, SDL_XColorMap);
    
  •   XSetWindowColormap(SDL_Display, WMwindow, SDL_XColorMap);
    
  •   if( !SDL_windowid ) {
    
  •       XSetWindowColormap(SDL_Display, FSwindow, SDL_XColorMap);
    
  •       XSetWindowColormap(SDL_Display, WMwindow, SDL_XColorMap);
    
  •   }
    
      /* Create the graphics context */
      gcv.graphics_exposures = False;

Mattias Engdeg?rd wrote:

Sorry, it was indeed my fault. The patch below should fix it (though I have
not tested it on strange visuals yet). Sam, please apply it and accept
my apologies.

Everything is working again, thanks !

Leonardo

Mattias Engdeg?rd wrote:

Sorry, it was indeed my fault. The patch below should fix it (though I have
not tested it on strange visuals yet). Sam, please apply it and accept
my apologies.

Everything is working again, thanks !

Great, thanks guys!

-Sam Lantinga, Lead Programmer, Loki Entertainment Software