X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Frd-bomb.c;h=3641282f700da31ff161edca61acde5155653987;hp=a537eadc6b49168ea367d294326cb61452460f61;hb=f54438ea00f152166e68073e98000fd3a00f65cd;hpb=f65151994eba80ecabcdac6eef6fa0dde7e2d45b diff --git a/hacks/rd-bomb.c b/hacks/rd-bomb.c index a537eadc..3641282f 100644 --- a/hacks/rd-bomb.c +++ b/hacks/rd-bomb.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998 +/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998, 1999 * Jamie Zawinski * * reaction/diffusion textures @@ -436,6 +436,31 @@ screenhack (Display *dpy, Window win) vdepth <= 16 ? 16 : 32); + /* Ok, this like, sucks and stuff. There are some XFree86 systems + that have depth-24 visuals, that do not accept depth-32 XImages! + Which if you ask me is just absurd, since all it would take is + for the server to truncate the bits in that case. So, this crap + here detects the specific case of: we have chosen depth 32; + and the server does not support depth 32. In that case, we + try and use depth 16 instead. + + The real fix would be to rewrite this program to deal with + depth 24 directly (or even better, arbitrary depths, but that + would mean going through the XImage routines instead of messing + with the XImage->data directly.) + */ + if (pdepth == 32) + { + int i, pfvc = 0; + Bool ok = False; + XPixmapFormatValues *pfv = XListPixmapFormats (dpy, &pfvc); + for (i = 0; i < pfvc; i++) + if (pfv[i].depth == pdepth) + ok = True; + if (!ok) + pdepth = 16; + } + cmap = xgwa.colormap; ncolors = get_integer_resource ("colors", "Integer");