diff src/video/x11/SDL_x11video.c @ 1641:5cf11b00b900

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.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 17 Apr 2006 04:54:08 +0000
parents c3b5d17277d4
children 0a53c90a37f9 c2c6ff414ef5
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Mon Apr 17 03:58:29 2006 +0000
+++ b/src/video/x11/SDL_x11video.c	Mon Apr 17 04:54:08 2006 +0000
@@ -557,6 +557,9 @@
 	  	vformat->Gmask = SDL_Visual->green_mask;
 	  	vformat->Bmask = SDL_Visual->blue_mask;
 	}
+	if ( this->hidden->depth == 32 ) {
+		vformat->Amask = (0xFFFFFFFF & ~(vformat->Rmask|vformat->Gmask|vformat->Bmask));
+	}
 	X11_SaveVidModeGamma(this);
 
 	/* See if we have been passed a window to use */
@@ -772,6 +775,7 @@
 	int i, depth;
 	Visual *vis;
 	int vis_change;
+	Uint32 Amask;
 
 	/* If a window is already present, destroy it and start fresh */
 	if ( SDL_Window ) {
@@ -822,9 +826,15 @@
 	this->hidden->depth = depth;
 
 	/* 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,
-			vis->red_mask, vis->green_mask, vis->blue_mask, 0) )
+			vis->red_mask, vis->green_mask, vis->blue_mask, Amask) ) {
 		return -1;
+	}
 
 	/* Create the appropriate colormap */
 	if ( SDL_XColorMap != SDL_DisplayColormap ) {