Xref: utzoo comp.windows.x:24446 comp.windows.x.motif:90 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!mcnc!decvax.dec.com!maxx!tyager From: tyager@maxx.UUCP (Tom Yager) Newsgroups: comp.windows.x,comp.windows.x.motif Subject: Re: Colormaps Message-ID: <59@maxx.UUCP> Date: 16 Jul 90 02:58:42 GMT References: <1990Jul13.183517.23734@media.uucp> Organization: MAXX: Tom Yager's UNIX lab, Amherst, NH. Lines: 44 In article <1990Jul13.183517.23734@media.uucp>, arthur@media.uucp (Art Poley) writes: > Does anyone know how to preserve the colors used by the motif window manager > within my 256 element colormap? Basically, I would like to create a (256 - N) > element colormap. Where N would be the number of colors needed to preserve > the 3D-look, menus, etc. used by the mwm. Due to the dynamic nature of the > imaging colormap, sharing of colormaps does not seem like a good approach. > I'd really just assume that N out of my 256 are reserved for the window manager. > Hopefully N won't be to large (16 or less?). > > If anyone has any suggestions, references, etc., I'd really appreciate it. > Art Poley - Media Cybernetics Phone: (301)495-3305 > Internet: arthur%media@uunet.uu.net UUCP: {uunet,hqda-ai}!media!arthur If you use XSetWindowColormap() to install the colormap, and mwm's colormapFocusPolicy resource is set to "keyboard," then that window's map should be active whenever it has input focus. When you shift focus away from that window, the default colormap (and, therefore, mwm's shading) should be restored. Is that not sufficient? Writing your application to set aside a fixed number of colors for external use is possible, but limiting. I'm a little shaky on this; one of the others may want to correct or clarify: You can replace the system's default colormap, allocating all but 16 cells for your own use. Then, programs which run after this change wouldn't touch your colors. I'd say that's "breaking the rules," however, since you're making serious assumptions about what other applications the user will want to run alongside your own. This approach also requires that you restart the window manager and other applications after you've reset the map. That's a pain, too. The best-behaved thing to do, I think, is either to install a window-bound colormap, or just use the default map. Keep allocating colors until you run out, and apply your color transforms based on the number of colors you get. The Motif-based Mandelbrot generator I've written uses that policy, and that helps it to run well on anything from monochrome to 8-plane. I give the user the option (at run time) whether to use a private colormap. Good luck. (ty) -- +--Tom Yager, Technical Editor, BYTE----Reviewer, UNIX World---------------+ | NET: decvax!maxx!tyager -or- uunet!bytepb!maxx!tyager | | I speak only for myself "UNIX: It's not a job, | +-------------------------------------it's a Jihad!" -co-worker------------+