Path: utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!keith
From: keith@EXPO.LCS.MIT.EDU (Keith Packard)
Newsgroups: comp.windows.x
Subject: Re: colormap problems
Message-ID: <8812020448.AA11764@EXPO.LCS.MIT.EDU>
Date: 2 Dec 88 04:48:01 GMT
References: <8812011738.AA10854@ws12.sag.uucp>
Sender: daemon@bloom-beacon.MIT.EDU
Organization: The Internet
Lines: 48


> I am trying to use my own color map in a window rather than the system default.
> After the window has been created I create the colormap and attach it to the 
> window by calling:
> 
> color_map = XCreateColormap( display, window_id, visual, AllocAll );
> XSetWindowColormap( display, window_id, color_map );
> 
> To get the color cells allocated I use
> 
> XStoreColor( display, colormap, &color_cell );
> 
> A call to XQueryColor returned the correct values in the cell.
> 
> Unfortunately the window appears to still be using the default colormap.
> 
> Laurie Clow
> 

This is all fine.  The only question is:  who is going to install the
colormap.  To actually get the hardware to use a colormap, it must be
installed.  

As colormaps are a scarce resource (much hardware only has one), the
appropriate client for the task is the window manager.  Conventions are
being established to communicate with the window manager the desired
behaviour.

Right now, R3 uwm manages colormaps which are installed on top-level
windows.  So, if you set the colormap of the top-level window for the
application to the colormap you want installed, and run uwm, you'll get the
colormap installed whenever the keyboard is directed at your client (i.e.
whenever the mouse is inside the window for PointerRoot focus).

If you aren't using uwm, you'll either have to fix the window manager you
are using to install colormaps (a difficult task) or simply call
XInstallColormap within the client application.  The trouble with doing the
latter is that when the application is run with a window manager that
manages colormaps, you'll end up fighting the window manager for control of
the colormap.

I expect that within a few months of the release of the ICCCM, most of the
publically available window managers will have rudimentary colormap support.

						Keith Packard
						MIT X Consortium
						(617) 253-1428
						keith@EXPO.LCS.MIT.EDU