dshr@SUN.COM (David Rosenthal) (11/03/88)
Read Section 9.2.1 of the Xlib manual. If the standard maps do not exist, the application should create appropriate maps. David.
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (11/03/88)
The following swatch of code should retrieve a standard colormap for the display, but XGetStandardColormap() fails. I've confirmed that the window referenced by RootWindow() has been realized. Is there something else that must happen before this function can succede? Yes: someone must actually create and store a StandardColormap. There aren't any by default in a server, and I don't know of any window managers that have options to create them. It's been on our TODO list to write a library function and a client to create them, but it didn't happen in time for R3. If someone wants to contribute code ...
evensen@husc9.Harvard.EDU (Erik Evensen) (05/04/91)
I'm working on an application where it would be very desireable to use the XA_RGB_BEST_MAP standard colormap. My problem is that I can't seem to get this Colormap. I read and tried out the pertinent sections in both Oliver Jones's book and Scheifler & Gettys's opus but nothing seems to work; i.e., XGetStandardColormap and XGetRGBColormaps return 0 for status. The code I've tried looks something like this: Display *gVfbDisplay; /* display we are attached to */ XStandardColormap gVfbBestRGB; /* the best rgb color map */ if ((gVfbDisplay = XOpenDisplay("")) == NULL) return VFBFAIL; if (XGetStandardColormap(gVfbDisplay, DefaultRootWindow(gVfbDisplay), &gVfbBestRGB, XA_RGB_BEST_MAP) == 0) { printf("failed to get standard colormap...goodbye\n"); exit(-1); } or XStandardColormap *gVfbBestRGB; int nMaps; if (XGetRGBColormaps(gVfbDisplay, DefaultRootWindow(gVfbDisplay), &gVfbBestRGB, &nMaps, XA_RGB_BEST_MAP) == 0) { printf("failed to get standard colormap...goodbye\n"); exit(-1); } I read faq #117 "Why can't my program get a standard colormap?" but this didn't really shed any light on the topic. I'm using X11R4 on various machines (Sparcs and DecStations) using both the console and (primarily) an NCD color X-terminal for display. I'm using the twm window manager. Actually, I guess the only thing I haven't tried is the prescription in appendix D of Scheifler & Gettys. But I think this looks like an awfully messy and unfriendly thing to do -- looks like it should be reserved for window managers... Thanks in advance for any help or pointers... --Erik (evensen@husc9.harvard.edu)
converse@expo.lcs.mit.EDU (Donna Converse) (05/04/91)
> I'm working on an application where it would be very desireable > to use the XA_RGB_BEST_MAP standard colormap. My problem is that > I can't seem to get this Colormap. The standard colormaps are not necessarily existing, and asking for them does not cause them to be created. This is confusing to many people. One way to cause the standard colormaps to be created is to run the client xstdcmap. Another way is to write your own routines to create and define the standard colormap properties. There are interfaces in the R4 Xmu library that you can use, if you don't have the R4 xstdcmap client on your machine. The use of XGetStandardColormap is deprecated in favor of the interface XGetRGBColormaps.