Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11video.c @ 236:3f09f52ac2cc
Fixed X11 icon color allocation (thanks Mattias!)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 07 Nov 2001 17:59:07 +0000 |
parents | 2a8d929f50e0 |
children | e8157fcb3114 |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c Wed Nov 07 17:58:41 2001 +0000 +++ b/src/video/x11/SDL_x11video.c Wed Nov 07 17:59:07 2001 +0000 @@ -501,7 +501,6 @@ if ( SDL_XPixels ) { int numcolors; unsigned long pixel; - numcolors = SDL_Visual->map_entries; for ( pixel=0; pixel<numcolors; ++pixel ) { while ( SDL_XPixels[pixel] > 0 ) { @@ -1050,10 +1049,10 @@ c = all + best; if(XAllocColor(GFX_Display, SDL_XColorMap, c)) { /* got it */ - colors[best].r = c->red >> 8; - colors[best].g = c->green >> 8; - colors[best].b = c->blue >> 8; - ++SDL_XPixels[best]; + colors[c->pixel].r = c->red >> 8; + colors[c->pixel].g = c->green >> 8; + colors[c->pixel].b = c->blue >> 8; + ++SDL_XPixels[c->pixel]; } else { /* * The colour couldn't be allocated, probably being @@ -1205,12 +1204,12 @@ } if ( SDL_iconcolors ) { unsigned long pixel; - int numcolors = - ((this->screen->format)->palette)->ncolors; - for ( pixel=0; pixel<numcolors; ++pixel ) { - while ( SDL_iconcolors[pixel] > 0 ) { - XFreeColors(SDL_Display, - SDL_DisplayColormap,&pixel,1,0); + Colormap dcmap = DefaultColormap(SDL_Display, + SDL_Screen); + for(pixel = 0; pixel < 256; ++pixel) { + while(SDL_iconcolors[pixel] > 0) { + XFreeColors(GFX_Display, + dcmap, &pixel, 1, 0); --SDL_iconcolors[pixel]; } }