Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!sco!mikep From: mikep@sco.COM (Mike Patnode) Newsgroups: comp.windows.x Subject: XAllocColor() doesn't return closest color Message-ID: <7924@scolex.sco.COM> Date: 27 Sep 90 02:47:31 GMT Sender: news@sco.COM Reply-To: mikep (Mike Patnode) Distribution: na Organization: The Santa Cruz Operation, Inc. Lines: 29 It seems that XAllocColor() will not try to approximate colors on PseudoColor displays when none are available. Given that you have a full colormap, and the color you specifically want does not exist, shouldn't XAllocColor() return the closest read-only color value available? In mit/server/dix/colormap.c, AllocColor() only does the following: case PseudoColor: if (FindColor(pmap, pmap->red, entries, &rgb, pPix, PSEUDOMAP, client, AllComp) != Success) return (BadAlloc); break; FindColor either finds the preexisting color, or allocates a new one. Shouldn't FindBestPixel() be called when FindColor() fails? Note that O'Reilly claims XAllocColor() should work this way, while the Red Book sort of side steps the issue. Is the O'Reilly book just wrong? -- Mike Patnode The Santa Cruz Operation SCO Software Engineer 400 Encinal Street {ucscc,uunet}!sco!mikep mikep@sco.COM P.O. Box 1900 (408) 458-1422 Santa Cruz, CA 95061