From 5d814502697ac4bec68abcc2cf615e4f5444c629 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Wed, 28 May 2008 09:41:20 +0000 Subject: 20080528-1040 --- CHANGES | 2 ++ emu/port/win-x11a.c | 60 ++++++++++++++++++++++++++++++++++++++++++----------- include/version.h | 2 +- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index 94db464a..02b7a314 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +20080528 + emu/port/win-x11a.c screen depth checks from drawterm via tim@nop.cx 20080524 add missing NetBSD files 20080522 diff --git a/emu/port/win-x11a.c b/emu/port/win-x11a.c index b9a3b545..c15c8bf0 100644 --- a/emu/port/win-x11a.c +++ b/emu/port/win-x11a.c @@ -152,7 +152,6 @@ clean_errhandlers(void) uchar* attachscreen(Rectangle *r, ulong *chan, int *d, int *width, int *softscreen) { - ulong c; int depth; Xsize &= ~0x3; /* ensure multiple of 4 */ @@ -162,12 +161,8 @@ attachscreen(Rectangle *r, ulong *chan, int *d, int *width, int *softscreen) r->max.x = Xsize; r->max.y = Ysize; - c = displaychan; - if(c == 0) - c = CMAP8; - if(!triedscreen){ - xinitscreen(Xsize, Ysize, c, chan, d); + xinitscreen(Xsize, Ysize, displaychan, chan, d); /* * moved xproc from here to end since it could cause an expose event and * hence a flushmemscreen before xscreendata is initialized @@ -673,6 +668,8 @@ xinitscreen(int xsize, int ysize, ulong c, ulong *chan, int *d) XClassHint classhints; XSizeHints normalhints; XSetWindowAttributes attrs; + XPixmapFormatValues *pfmt; + int i, n; xdrawable = 0; @@ -693,8 +690,51 @@ xinitscreen(int xsize, int ysize, ulong c, ulong *chan, int *d) screen = DefaultScreenOfDisplay(xdisplay); xcmap = DefaultColormapOfScreen(screen); - *chan = CMAP8; - *d = 8; + /* + * xscreendepth is only the number of significant pixel bits, + * not the total number of pixel bits. We need to walk the + * display list to find how many actual bits are used + * per pixel. + */ + if(c == 0){ + pfmt = XListPixmapFormats(xdisplay, &n); + for(i=0; iclass != StaticColor) { if(TYPE(c) == CGrey) @@ -890,10 +930,6 @@ initmap(XWindow w, ulong cc, ulong *chan, int *d) infernobtox11[i] = (c.pixel>>0)&0xff; } } - if(TYPE(cc) != CGrey && cc != CMAP8 && xscreendepth >= 24){ - *chan = XRGB32; - *d = 32; - } } else if(xvis->class == PseudoColor) { if(xtblbit == 0){ diff --git a/include/version.h b/include/version.h index a2f53183..8436b644 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define VERSION "Fourth Edition (20080524)" +#define VERSION "Fourth Edition (20080528)" -- cgit v1.2.3