Commit fccd61bc authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #197

On servers with the composite extension enabled, visuals with 32-bit depth
have an alpha mask.  This is pretty neat, but SDL needs a bit more work to
handle these properly, so for now, we'll just use 24 bit depth visuals.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401648
parent 8a7b961a
...@@ -620,7 +620,11 @@ int X11_GetVideoModes(_THIS) ...@@ -620,7 +620,11 @@ int X11_GetVideoModes(_THIS)
#endif /* SDL_VIDEO_DRIVER_X11_XME */ #endif /* SDL_VIDEO_DRIVER_X11_XME */
{ {
/* It's interesting to note that if we allow 32 bit depths,
we get a visual with an alpha mask on composite servers.
static int depth_list[] = { 32, 24, 16, 15, 8 }; static int depth_list[] = { 32, 24, 16, 15, 8 };
*/
static int depth_list[] = { 24, 16, 15, 8 };
int j, np; int j, np;
int use_directcolor = 1; int use_directcolor = 1;
XPixmapFormatValues *pf; XPixmapFormatValues *pf;
......
...@@ -557,6 +557,9 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -557,6 +557,9 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
vformat->Gmask = SDL_Visual->green_mask; vformat->Gmask = SDL_Visual->green_mask;
vformat->Bmask = SDL_Visual->blue_mask; vformat->Bmask = SDL_Visual->blue_mask;
} }
if ( this->hidden->depth == 32 ) {
vformat->Amask = (0xFFFFFFFF & ~(vformat->Rmask|vformat->Gmask|vformat->Bmask));
}
X11_SaveVidModeGamma(this); X11_SaveVidModeGamma(this);
/* See if we have been passed a window to use */ /* See if we have been passed a window to use */
...@@ -772,6 +775,7 @@ static int X11_CreateWindow(_THIS, SDL_Surface *screen, ...@@ -772,6 +775,7 @@ static int X11_CreateWindow(_THIS, SDL_Surface *screen,
int i, depth; int i, depth;
Visual *vis; Visual *vis;
int vis_change; int vis_change;
Uint32 Amask;
/* If a window is already present, destroy it and start fresh */ /* If a window is already present, destroy it and start fresh */
if ( SDL_Window ) { if ( SDL_Window ) {
...@@ -822,9 +826,15 @@ static int X11_CreateWindow(_THIS, SDL_Surface *screen, ...@@ -822,9 +826,15 @@ static int X11_CreateWindow(_THIS, SDL_Surface *screen,
this->hidden->depth = depth; this->hidden->depth = depth;
/* Allocate the new pixel format for this video mode */ /* Allocate the new pixel format for this video mode */
if ( this->hidden->depth == 32 ) {
Amask = (0xFFFFFFFF & ~(vis->red_mask|vis->green_mask|vis->blue_mask));
} else {
Amask = 0;
}
if ( ! SDL_ReallocFormat(screen, bpp, if ( ! SDL_ReallocFormat(screen, bpp,
vis->red_mask, vis->green_mask, vis->blue_mask, 0) ) vis->red_mask, vis->green_mask, vis->blue_mask, Amask) ) {
return -1; return -1;
}
/* Create the appropriate colormap */ /* Create the appropriate colormap */
if ( SDL_XColorMap != SDL_DisplayColormap ) { if ( SDL_XColorMap != SDL_DisplayColormap ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment