[comp.windows.x] problems with X colormaps

leon_h@euteal.uucp (Leon Ham) (07/12/89)

Problem description: using a private Colormap on Apollo using
                     the Xapollo server.

In one of my applications I use a colormap private to this program.
Since I neither want to corrupt the domain-windows nor the other
running X applications, I only use entries 64 until 253 in my program.

To prevent the other applications from vanishing off the screen (by
becoming displayed in black) I want to copy all entries from 0 until
63 of the default colormap into my application's private colormap.
I do this by calling XQueryColor for all desired pixel values from
the XDefaultColormap and storing the retrieved colors into my private
colormap with ues of XStoreColor.

This works well, except for those entries the domain window manager
uses: 0, 1 and 8 until 15. Those entries are protected by the Xapollo
server. An XQueryColor call to those entries will result in returning
an empty color cell (Black).

Initially, I tried to solve the problem by creating the private colormap
with XCopyColormapAndFree. This didn't work: the domain entries weren't
copied into the private colormap.

This gives us reason to believe that the colors in the domain entries are
not allocated by the Xapollo server, for if this wasn't true, a call to
XQueryColor would return the actual value of the color cell concerned.

Here, at the Eindhoven University of Technology, we found a way to prevent
the domain entries in the colormap from appearing black by executing the
following for every domain entry:

	XParseColor (Xdisplay, Xdefault_colormap, color_name, &Xcolor);
	XAllocColor (Xdisplay, Xdefault_colormap, &Xcolor);

	XStoreColor (Xdisplay, Xcolormap, &Xcolor);

where 'color_name' is either the hex-value of the domain color, or the
corresponding X name found in /usr/lib/X11/rgb.txt with rgb entries exact
those of the domain color.

The disadvantage of the approach above is that the application program
needs the exact rgb values installed in the domain entries and that there
is no way of retrieving them by means of call(s) to any X function.

Is there an other approach known outthere, or did we run into a bug of the
Xapollo server?? Or did we misunderstand something??
--
+---------------------------------------+---------------------------------------+
| Leon C.G.A.M. Ham                     | Room EH 7.25                          |
| Eindhoven University of Technology    | P.O. Box 513                          |
| Department of Electrical Engineering  | NL-5600 MB Eindhoven                  |
+---------------------------------------+---------------------------------------+
| Phone: +31 (40) 473345/3238           | Email: leon_h@es.ele.tue.nl           |
+---------------------------------------+---------------------------------------+