laurie@sol.UUCP (Laurie Clow) (12/02/88)
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. If I allocate cells in the default map as well as my new colormap and set them appropriately the map is drawn up correctly. I'm using a Sun 3/60 and R3 of the server. I really appreciate any help that anyone can give me on this. Laurie Clow UUCP: {ucbvax!ucsd,seismo}!esosun!sol!laurie (Lauren Clow) (619) 546-6409 ARPA: esosun!sol!laurie@seismo.css.gov
keith@EXPO.LCS.MIT.EDU (Keith Packard) (12/02/88)
> 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