Path: utzoo!attcan!uunet!aplcen!samsung!think!husc6!bu-cs!xylogics!world!madd From: madd@world.std.com (jim frost) Newsgroups: comp.windows.x Subject: Re: Colormaps Message-ID: <1989Nov20.181802.20235@world.std.com> Date: 20 Nov 89 18:18:02 GMT References: <5932@cs.yale.edu> Organization: Software Tool & Die Lines: 25 gropp-bill@CS.Yale.EDU (Bill Gropp) writes: >What is the best way to do the following: > I have an application that wants to have its own colormap for a window; > the colors in this window should be dynamic and defineable by the > application. [...] > When my colormap is installed by the window manager, I'd like the > least damage done to other applications. Since later in your note you say you're using XAllocColor, I assume "dynamic" doesn't mean "read/write". With that in mind, the more-or-less standard way to do this is to do XAllocColor calls on DefaultColormap(). If the allocation fails, use XCopyColormapAndFree() to get a new colormap, after which it's pretty likely that some other applications' colors will be reused. Most of the time it works great. This is fairly standard and is what I do for everything except image processing, where you have to allocate lots of writable colors. Should work fine for your application. Sample code abounds in the contrib directory. jim frost software tool & die madd@std.com