Fixed X11 8bpp crashes, but 8bpp still didn't work well.

This commit is contained in:
johns 2001-02-12 22:27:20 +00:00
parent f9f180a4e7
commit 839589e3d5

View file

@ -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 ) {