[comp.windows.x] menu with installed colormap

aw@cellar.bae.bellcore.com (Andrew Wason) (09/15/90)

I have a client which needs its own colormap.
I created a colormap and set the XtNcolormap resource
of the topLevelShell widget to this colormap.
I allocated 250 cells read/write out of the colormap,
leaving 6 cells shareable.

I also have a simpleMenu widget which pops up in
the topLevel widget. I checked, and the simpleMenu XtNcolormap resource
is set correctly to my new colormap (because it copies from parent by default).
However, the menu is unreadable due to the colors it is using.

The simpleMenu uses XtDefaultForeground and XtDefaultBackground
as its default colors. In lib/Xt/Converters.c CvtStringToPixel()
these strings are converted to BlackPixelOfScreen() and WhitePixelOfScreen().
These two macros return pixel values relative to the default colormap.
So, even though my colormap is currently installed,
the simpleMenu pops up with its foreground/background pixel values
incorrectly set based on the default colormap.

In CvtStringToPixel(), if the color string is anything other than
XtDefaultForeground or XtDefaultBackground then the currently installed
colormap is used. Why is the currently installed colormap ignored
for these two strings? Is this a bug in the Intrinsics?

Specifying the following in my resources makes everything work fine:
(since these strings are not XtDefaultForeground or XtDefaultBackground,
the currently installed colormap is used to determine their pixel values):

  *SimpleMenu*foreground: black
  *SimpleMenu*background: white


Thanks,
Andrew

--------------------------------------------------------------------------------
Andrew Wason                                        Bell Communications Research
aw@cellar.bae.bellcore.com                          Piscataway, NJ
bellcore!cellar!aw

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (09/26/90)

    In CvtStringToPixel(), if the color string is anything other than
    XtDefaultForeground or XtDefaultBackground then the currently installed
    colormap is used. Why is the currently installed colormap ignored
    for these two strings?

These two values should only be used with the default colormap.  No
other colormap contains "default" pixel values defined for this purpose.

    Is this a bug in the Intrinsics?

It isn't very well documented, but I'd say no.  Now, it may well be a
"misfeature".  I suppose you could argue that these values should
arbitrarily default to something when the colormap isn't the default
colormap, perhaps "black" and "white", or perhaps the result of
looking up two resources in the resource database.  Please note that
the default fg/bg in the default colormap are not necessarily black and
white.  You haven't said what semantics you think should be applied in
the non-default colormap case, so I don't know what you really want.
You're welcome to propose something (whether anyone will really listen,
I don't know :-).