[comp.windows.x] Sharing colormaps?

pinkas@cad001.intel.com (Israel Pinkas ~) (07/10/89)

Our group is developing a group of related applications.  Each of the
applications needs 64 colors at startup, and might want to allocate a few
more.  Since we need so many colors, we create a new colormap with the
right colors.  (We need to have a relation between colors so that we can do
things like highlighting by working on certain planes.)  We can assume that
the server has a Visual with writable colormap, like PseudoColor.

We would like to share the colormap between all of our applications.  This
would guarantee that when the colormap was installed, all the related
applications would have the correct colors installed.  If the colormap is
not shared, we cannot guarantee that the related applications will have the
standard colors installed at the same location.

I can create the colormap from one applications, and either place the
colormap ID (and the the pixel numbers of the standard colors) as a
property on the root window, or use the selection mechanism.  (The
applications that created the colormap would own the selection.)  This
could even be a special client that just allocates the colormap and
initializes the colors.

Two questions arise.  (1) Is there any way to tell the server that the
colormap should not be destroyed when the application that created it
exits?  (2) Is there any way to turn read/write colors into read-only?

The need for the formaer should be obvious.  The latter is needed so that
if the application that created the colormap does exit, and the colormap
stays around, the server will not reuse those colors.  Actually, what I
really want is for the colors to remain allocated even when the application
that allocated them disconnects.

Can this be done in R3?  If not, will R4 allow this?

Please send responses to me.  I will summarize if there is interest.

-Israel Pinkas
--
--------------------------------------
Disclaimer: The above are my personal opinions, and in no way represent
the opinions of Intel Corporation.  In no way should the above be taken
to be a statement of Intel.

UUCP:	{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!cadev4!pinkas
ARPA:	pinkas%cadev4.intel.com@relay.cs.net
CSNET:	pinkas@cadev4.intel.com

rws@EXPO.LCS.MIT.EDU (07/10/89)

    (1) Is there any way to tell the server that the
    colormap should not be destroyed when the application that created it
    exits?

Create the colormap, and allocate the entries, using a separate connection.
Use XSetCloseDownMode to set RetainPermanent before closing this connection.

    (2) Is there any way to turn read/write colors into read-only?

No, but the RetainPermanent will ensure that writable allocations persist.
(Hmm, since the writing client will no longer exist, it would be interesting
if the server changed the entries to read-only on close.  Needs some thought.)