Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

Top Document: Motif FAQ (Part 9 of 9)
Previous Document: 307) Why can't I install my own colormap using XInstallColormap?
Next Document: 309) How do I get correct shadow colors to match other color


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

308) How do I install a private colormap?


[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.



Top Document: Motif FAQ (Part 9 of 9)
Previous Document: 307) Why can't I install my own colormap using XInstallColormap?
Next Document: 309) How do I get correct shadow colors to match other color

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)

Last Update May 13 2007 @ 00:23 AM