Re: XForms: separate colormap for canvas - problems

Trent Piepho (
Sat, 22 Nov 1997 16:28:00 -0800 (PST)

To subscribers of the xforms list from Trent Piepho <> :

On Sat, 22 Nov 1997, Steve Lamont wrote:
> To subscribers of the xforms list from (Steve Lamont) :
> > Unfortunately, this does not work as I expected. It is OK if it
> > allocates all colors in the first loop. But when this fails,
> > program creates new colormap, successfully allocates all colors (!)
> > but on the screen I get majority of colors in the image canvas
> > being not gray but brown/green/blue. And there is no color flashing when
> > I move mouse pointer in/out the canvas (what I expected should happen if
> > the canvas has different colormap - it is even mentioned in the XForms
> > manual in fl_create_colormap description).
> What you're doing is right and, as far as I can tell, what XForms is
> doing is right but obviously something's wrong somewhere.

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.

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.

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.

|Gazing up to the breeze of the heavens \ on a quest, meaning, reason |
|came to be, how it begun \ all alone in the family of the sun |
|curiosity teasing everyone \ on our home, third stone from the sun. |
|Trent Piepho ( -- Metallica |

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