[SDL] SDL_WINDOWID problems

Mattias Engdegård f91-men at nada.kth.se
Mon Apr 3 10:51:03 PDT 2000


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;



More information about the SDL mailing list