Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!converse From: converse@EXPO.LCS.MIT.EDU (Donna Converse) Newsgroups: comp.windows.x Subject: Re: problem with colormap (X11) Message-ID: <8910261439.AA16357@expo.lcs.mit.edu> Date: 26 Oct 89 14:39:04 GMT References: <1989Oct25.163000.19611@hellgate.utah.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: X Consortium, MIT Laboratory for Computer Science Lines: 50 > I create a private colormap for a specific window as follows: > > my_cmap = XCreateColormap(display, win, visual, AllocAll); > XSetWindowColormap(dipaly, win, my_cmap); This notifies the window manager that this window should have your private colormap installed when the window gets the input focus. The colormap should be installed immediately, so as a side effect, if your program has already opened a window on the screen, you may be able to see the colormap change as your program is running. However, some R3 window managers ignore your colormap request, and while running under those particular window managers, you must install and uninstall the colormap yourself. When running under window managers that do not ignore the colormap request, you must not install and uninstall the colormap from your application. > for (i = 0; i<64; i++) { > Color[i].pixel = i; > Color[i].red = ... > Color[i].green = ... > Color[i].blue = ... > ... You set Color[i].flags = DoRed | DoGreen | DoBlue , don't you? > } > XStoreColors(display, cmap, Color, 64); cmap is the same as my_cmap, right? > > Later in my program, I use > > XCreateGC(display, win, ...); > XSetForeground(display, gc, Color[i].pixel); > XFillRectangle(display, win, gc, ...); > > to form some images. > > It turns out that I always get colors from the default colormap > instead of the private one. Where did I do wrong?? Other than the questions that I raised, your code looks fine. If you still have trouble, tell us the server and window manager that you are using. Donna Converse converse@expo.lcs.mit.edu