Path: utzoo!attcan!uunet!jarthur!usc!snorkelwacker!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: Xsun on cg4 (Sun 3/60) Message-ID: <9003090649.AA11176@Larry.McRCIM.McGill.EDU> Date: 9 Mar 90 06:49:05 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 72 [ >> = me ] [ > = mcsun!ukc!acorn!john@uunet.uu.net (John Bowler) in <1798@acorn.co.uk> ] >> (Actually, the 1-bit screen [on a Sun cg4] *should* be a PseudoColor >> screen; that's what the hardware is. But StaticGray was easier, no >> doubt.) > Last time I tried making a server do this a very large number of the > clients (I admit, R2 clients) became unhappy. The problem is an > exaggerated example of the ``running out of colours'' problems people > have with shallow PseudoColor displays; [...]. This is an *excellent* reason to do it this way: it weeds out broken clients. (It would be nice to have a -staticgray switch so the broken clients can be run.) Besides, things have improved. I hacked on the cg2 code to take advantage of the alternate view provided by the hardware[%], and the resulting 1-bit PseudoColor screens never give me any trouble. (This was the R3 server; I haven't (yet) made the appropriate changes to the R4 server.) > On a display with a default depth 1 PseudoColor visual there are no > free colormap cells in the default map - because the server has > already allocated White and Black for the black and white pixels. It > has all the attributes of a StaticGray display but none of the > advantages; in particular Alloc[Named]Color never fails on a colormap > from a static visual through not being able to arrange for a suitable > (:-)) colour in the colormap. The client should not - without explicit directions from the user - insist on getting its colors from the default colormap; it should create its own colormap if necessary. You do get technicolor effects, and each application (well, each window) is restricted to at most two colors, but there's no way around that, and you do have color. All[$] my clients do something like setup_color(str,col,what) char *str; XColor *col; char *what; { if (XParseColor(disp,wincmap,str,col) == 0) { fprintf(stderr,"%s: bad color `%s'\n",argv0,str); exit(1); } while (1) { if (XAllocColor(disp,wincmap,col) == 0) { if (wincmap != defcmap) { fprintf(stderr, "%s: can't allocate colormap cell for color `%s'\n", argv0,str); exit(1); } wincmap = XCopyColormapAndFree(disp,wincmap); continue; } break; } } [%] The cg2 has 8 bits per pixel, but the hardware lets you access it as either one 8-bit plane or 8 one-bit planes (or even both at once, but it's up to you to keep it straight). [$] Well, all the ones that have been overhauled since I realized how colormaps and colormap entries work. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu