Skip to content

Commit

Permalink
Fixed bug #616
Browse files Browse the repository at this point in the history
 rainer canavan      2009-03-29 12:30:12 PDT

add default visual to this->hidden->visuals

X11_SetIcon appears to have problems getting the correct bpp for the default
visual of my screen. With larger icons, this causes a segfault somewhere in
libX11. Instead of adding the default visual to the internal list, I can work
around this problem (both the segfault and the distortion) by setting bpp to 32
before sicon = SDL_CreateRGBSurface(...) in X11_SetIcon, although with this
patch, it stays at 24.
  • Loading branch information
slouken committed Sep 27, 2009
1 parent 7ec6170 commit fa9f128
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/video/x11/SDL_x11modes.c
Expand Up @@ -338,6 +338,18 @@ static void move_cursor_to(_THIS, int x, int y)
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;
Expand Down Expand Up @@ -801,6 +813,7 @@ int X11_GetVideoModes(_THIS)
add_visual(this, depth_list[i], StaticColor);
}
}
add_default_visual(this);
}
if ( this->hidden->nvisuals == 0 ) {
SDL_SetError("Found no sufficiently capable X11 visuals");
Expand Down

0 comments on commit fa9f128

Please sign in to comment.