src/video/x11/SDL_x11modes.c
branchSDL-1.2
changeset 4254 8afecb86be35
parent 4223 63fd67e17705
child 4274 915406c331dc
--- a/src/video/x11/SDL_x11modes.c	Sun Sep 27 22:29:13 2009 +0000
+++ b/src/video/x11/SDL_x11modes.c	Sun Sep 27 22:41:34 2009 +0000
@@ -338,6 +338,18 @@
     XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y);
 }
 
+static int add_default_visual(_THIS)
+{
+    int i;
+    int n = this->hidden->nvisuals;
+    for (i=0; i<n; i++) {
+        if (this->hidden->visuals[i].visual == DefaultVisual(SDL_Display, SDL_Screen)) return n;
+    }
+    this->hidden->visuals[n].depth = DefaultDepth(SDL_Display, SDL_Screen);;
+    this->hidden->visuals[n].visual = DefaultVisual(SDL_Display, SDL_Screen);;
+    this->hidden->nvisuals++;
+    return(this->hidden->nvisuals);
+}
 static int add_visual(_THIS, int depth, int class)
 {
     XVisualInfo vi;
@@ -801,6 +813,7 @@
                                 add_visual(this, depth_list[i], StaticColor);
                         }
                 }
+                add_default_visual(this);
         }
         if ( this->hidden->nvisuals == 0 ) {
             SDL_SetError("Found no sufficiently capable X11 visuals");