From 839589e3d5fce6dda6c463169d86e8ca374e8fa9 Mon Sep 17 00:00:00 2001 From: johns <> Date: Mon, 12 Feb 2001 22:27:20 +0000 Subject: [PATCH] Fixed X11 8bpp crashes, but 8bpp still didn't work well. --- src/video/X11.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/video/X11.cpp b/src/video/X11.cpp index 2d6b1a083..1ebee1893 100644 --- a/src/video/X11.cpp +++ b/src/video/X11.cpp @@ -174,20 +174,21 @@ global void GameInitDisplay(void) goto foundvisual; if(XMatchVisualInfo(TheDisplay, TheScreen, 24, TrueColor, &xvi)) goto foundvisual; - if(XMatchVisualInfo(TheDisplay, TheScreen, 8, TrueColor, &xvi)) - goto foundvisual; if(XMatchVisualInfo(TheDisplay, TheScreen, 8, PseudoColor, &xvi)) goto foundvisual; + if(XMatchVisualInfo(TheDisplay, TheScreen, 8, TrueColor, &xvi)) + goto foundvisual; fprintf(stderr,"Sorry, I couldn't find an 8, 15 , 16 or 24 bit visual.\n"); exit(-1); foundvisual: xpfv=XListPixmapFormats(TheDisplay, &i); - for(i--;i>=0;i--) { - DebugLevel0("pixmap %d\n", xpfv[i].depth); - if(xpfv[i].depth==xvi.depth) + for( i--; i>=0; i-- ) { + DebugLevel3("pixmap %d\n", xpfv[i].depth); + if( xpfv[i].depth==xvi.depth ) { break; + } } if(i<0) { fprintf(stderr,"No Pixmap format for visual depth?\n"); @@ -249,12 +250,13 @@ foundvisual: if(xvi.class==PseudoColor) { i|=CWColormap; attributes.colormap = - XCreateColormap( TheDisplay, xvi.screen, xvi.visual, AllocNone); + XCreateColormap( TheDisplay, DefaultRootWindow(TheDisplay), + xvi.visual, AllocNone); // FIXME: Really should fill in the colormap right now } window=XCreateWindow(TheDisplay,DefaultRootWindow(TheDisplay) ,0,0,VideoWidth,VideoHeight,3 - ,xvi.depth,InputOutput,xvi.visual ,i,&attributes); + ,xvi.depth,InputOutput,xvi.visual,i,&attributes); TheMainWindow=window; gcvalue.graphics_exposures=False; @@ -955,7 +957,8 @@ global VMemType* VideoCreateNewPalette(const Palette *palette) color.flags=DoRed|DoGreen|DoBlue; if( !XAllocColor(TheDisplay,xwa.colormap,&color) ) { fprintf(stderr,"Cannot allocate color\n"); - exit(-1); + // FIXME: Must find the nearest matching color + //exit(-1); } switch( VideoDepth ) {