comparison 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
comparison
equal deleted inserted replaced
1640:5eaab017cc28 1641:5cf11b00b900
555 if ( vformat->BitsPerPixel > 8 ) { 555 if ( vformat->BitsPerPixel > 8 ) {
556 vformat->Rmask = SDL_Visual->red_mask; 556 vformat->Rmask = SDL_Visual->red_mask;
557 vformat->Gmask = SDL_Visual->green_mask; 557 vformat->Gmask = SDL_Visual->green_mask;
558 vformat->Bmask = SDL_Visual->blue_mask; 558 vformat->Bmask = SDL_Visual->blue_mask;
559 } 559 }
560 if ( this->hidden->depth == 32 ) {
561 vformat->Amask = (0xFFFFFFFF & ~(vformat->Rmask|vformat->Gmask|vformat->Bmask));
562 }
560 X11_SaveVidModeGamma(this); 563 X11_SaveVidModeGamma(this);
561 564
562 /* See if we have been passed a window to use */ 565 /* See if we have been passed a window to use */
563 SDL_windowid = SDL_getenv("SDL_WINDOWID"); 566 SDL_windowid = SDL_getenv("SDL_WINDOWID");
564 567
770 int w, int h, int bpp, Uint32 flags) 773 int w, int h, int bpp, Uint32 flags)
771 { 774 {
772 int i, depth; 775 int i, depth;
773 Visual *vis; 776 Visual *vis;
774 int vis_change; 777 int vis_change;
778 Uint32 Amask;
775 779
776 /* If a window is already present, destroy it and start fresh */ 780 /* If a window is already present, destroy it and start fresh */
777 if ( SDL_Window ) { 781 if ( SDL_Window ) {
778 X11_DestroyWindow(this, screen); 782 X11_DestroyWindow(this, screen);
779 switch_waiting = 0; /* Prevent jump back to now-meaningless state. */ 783 switch_waiting = 0; /* Prevent jump back to now-meaningless state. */
820 vis_change = (vis != SDL_Visual); 824 vis_change = (vis != SDL_Visual);
821 SDL_Visual = vis; 825 SDL_Visual = vis;
822 this->hidden->depth = depth; 826 this->hidden->depth = depth;
823 827
824 /* Allocate the new pixel format for this video mode */ 828 /* Allocate the new pixel format for this video mode */
829 if ( this->hidden->depth == 32 ) {
830 Amask = (0xFFFFFFFF & ~(vis->red_mask|vis->green_mask|vis->blue_mask));
831 } else {
832 Amask = 0;
833 }
825 if ( ! SDL_ReallocFormat(screen, bpp, 834 if ( ! SDL_ReallocFormat(screen, bpp,
826 vis->red_mask, vis->green_mask, vis->blue_mask, 0) ) 835 vis->red_mask, vis->green_mask, vis->blue_mask, Amask) ) {
827 return -1; 836 return -1;
837 }
828 838
829 /* Create the appropriate colormap */ 839 /* Create the appropriate colormap */
830 if ( SDL_XColorMap != SDL_DisplayColormap ) { 840 if ( SDL_XColorMap != SDL_DisplayColormap ) {
831 XFreeColormap(SDL_Display, SDL_XColorMap); 841 XFreeColormap(SDL_Display, SDL_XColorMap);
832 } 842 }