[comp.windows.x] PseudoColor visuals and colormaps in OpenWindows

josh@viewlog.UUCP (Josh Marantz) (01/03/90)

The default visual for OpenWindows on a Sparc/GX is StaticColor, but I'd
like to use PseudoColor.  So I use XGetVisualInfo to find a PseudoColor
visual.  What then?  Do I have to create a private colormap and then battle
with ICCCM and non-ICCCM window managers to get it installed at the
appropriate times?  I only want 16 colors, so I really shouldn't be going
technicolor.  Will I?  Who controls where in the hardware colormap my
private colormap will get installed?  Hopefully, it will be in an area
that is seldom used by "typical" applications.  How can I help make this
happen?

I was hoping to find a call like XGetVisualColormap (dpy, vis, &map), where
if I had a visual, it would give me the corresponding colormap and I could
start allocating cells in it.

Any ideas?


-- 
Joshua Marantz
Viewlogic Systems, Inc.
cloud9!viewlog!josh@bu-cs.bu.edu

lemke@lupine.UUCP (Dave Lemke) (01/04/90)

> From: josh@viewlog.UUCP (Josh Marantz)
> 
> The default visual for OpenWindows on a Sparc/GX is StaticColor, but I'd
> like to use PseudoColor.  So I use XGetVisualInfo to find a PseudoColor
> visual.  What then?  Do I have to create a private colormap and then battle
> with ICCCM and non-ICCCM window managers to get it installed at the
> appropriate times?  I only want 16 colors, so I really shouldn't be going
> technicolor.  Will I?  Who controls where in the hardware colormap my
> private colormap will get installed?  Hopefully, it will be in an area
> that is seldom used by "typical" applications.  How can I help make this
> happen?

i'd recommend building your own colormap.  as far as fighting the WM
goes, i've personally given up on dealing with WMs that won't install a
colormap, but i used to just have some #ifdef'd code that (un)installed
it on Enter/Leave events.

you can't control where your colors land, nor whether they'll interfere
with the colors of other applications.

however, because of _implementation_ details of xnews, things should
work fine without any technicolor.  xnews leaves the first 16 colormap
segments unused in the static colormap for exactly your type of
application.  since colormap entries in xnews are allocated from the
start of the colormap, none of your cells will conflict with the
builtins.  when your colormap gets installed, it will only put its
allocated colors into the hardware colormap -- the rest of the hardware
colormap will contain the default colormap.

note that this is the behavior of xnews 1.0.  i don't think it will
change, but depending on it isn't a good idea.  you certainly can't
expect things to be the same with any other X server.

Dave Lemke				ARPA: lemke@ncd.com
Network Computing Devices, Inc. 	UUCP: uunet!ncd!lemke