From 5d814502697ac4bec68abcc2cf615e4f5444c629 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Wed, 28 May 2008 09:41:20 +0000 Subject: 20080528-1040 --- emu/port/win-x11a.c | 60 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 12 deletions(-) (limited to 'emu/port/win-x11a.c') 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){ -- cgit v1.2.3