Re: XForms: separate colormap for canvas - problems

Steve Lamont (
Sat, 22 Nov 97 20:23:39 PST

To subscribers of the xforms list from (Steve Lamont) :

> I did this a while ago, I had a program with a private colormap for
> its canvas window, but not for the rest of the form. As I recall there
> were several bugs I had to find. One was in xforms, it wasn't setting the
> XA_WM_COLORMAPS_WINDOWS property correctly. I think the problem was that
> it was getting set at the wrong time, after the window was created. I'm
> not sure, it's been a while. It may have been fixed by now.

I'm running 0.88 and the problem persists.

I don't think there's a restriction in X on when this property is
set. Before or after, it should work.

In fact, looking at the manual pages, XSetWMColormapWindows() must be
called after the Window is created, since it requires a Window XID to
identify which Windows have their own colormap.

> The other, more annoying problem, is a bug in twm and all it's
> derivatives, including fvwm and fvwm2. They simply don't handle the
> *_COLORMAPS_WINDOW property properly. What they do is when you
> first focus the top-level window is to install _all_ the colormaps
> for windows listed in the property. On machines that can have
> multiple colormaps at once, this works ok. But for machines with
> one colormap at a time, it doesn't work right.

I think this is the crux of the matter, as I tried to imply in the
posting, although perhaps not clearly enough. Indeed, I'm running
tvtwm, which is about as close a derivative of twm as you can get.
Test code shows that the property is being set but clearly not being

> When you move the pointer into the canvas, the WM _should_ have
> installed the colormap for it, but it doesn't. You need to trick
> it. How? Well, the window manager doesn't get an event when the
> pointer enters the canvas window, so give it one. Do this by
> changing the XA_WM.... property, which will have the window manager
> an event to think about. What the window manager will do is install
> all the colormaps in the property, either in order or in backwards
> order, I forget. Since only the last colormap installed will
> "stick", make the one you want the last colormap. Setup handles for
> Enter and Exit notify events, and have them change the property.

Tried that, to no avail. Either I did it wrong or the window manager
is more broken than I thought.

I'll try it with raw Xlib tomorrow if I get the chance, just to see if
it is an XForms/tvtwm (non)interaction related problem or not.

I guess I could look at the tvtwm source.

To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: