Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: Setting up color tables for an image. Message-ID: <8910230030.AA01902@Larry.McRCIM.McGill.EDU> Date: 23 Oct 89 00:30:11 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 31 >> I'm experimenting with a very simple X client to render color images. >> What is the correct sequence of calls to create and install the new >> colormap? >> cmap = XCreateColormap(dpy, XtWindow(box3), vis, AllocAll) ; >> XStoreColors(dpy, cmap, colors, ncolors) ; >> XInstallColormap(dpy,cmap); This is the correct sequence to do what you said. However, as someone else pointed out, this is not the Right Thing To Do. Only window managers should call XInstallColormap. What you should be doing is calling XSetWindowColormap. However, if you want your program to work when there is no window manager running, or when you're running under an old window manager that doesn't handle colormaps, you will probably find you have to call XInstallColormap yourself. I know of no reliable way to tell whether you will need to call XInstallColormap yourself (ie, a way to tell whether there's a colormap-compliant window manager running). What I chose to do when I ran into this problem was to assume the window manager will handle it, but provide an option the user can give on the command line to direct the program to do the installation itself, for use on another display with no wm or under a wm that doesn't handle colormaps correctly. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu