[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
[Last modified: Jan 96]
Answer: Mark Buser (buser@tartan.com) writes: If you find that your
XAllocNamedColor is failing or XpmCreatePixmapFromData is dieing from
XpmColorFaileds, you may have exhausted the number of colormap entries. One
way to install a new colormap is the following:
Toplevel = XtVaAppInitialize ( &app, ...
dpy = XtDisplay (Toplevel);
cmap = DefaultColormapOfScreen ( XtScreen( Toplevel) );
/* Detect color errors due to colormap depletion */
if (colors_depleted) {
cmap = XCopyColormapAndFree ( dpy, cmap );
/* Run through color allocation again to see if ok now */
}
/* Install colormap into toplevel widget. This must be done
** before any child widgets are created.
*/
XtVaSetValues ( Toplevel, XmNcolormap, cmap, NULL);
/* Create any children of toplevel, they will inherit new colormap */
This is only one way to go, there are other possibilities, but this seems to
be the simplest.
Send corrections/additions to the FAQ Maintainer:
Last Update May 13 2007 @ 00:23 AM