Re: XForms: separate colormap for canvas - problems

Trent Piepho (xyzzy@u.washington.edu)
Sun, 23 Nov 1997 00:43:29 -0800 (PST)

To subscribers of the xforms list from Trent Piepho <xyzzy@u.washington.edu> :

On Sat, 22 Nov 1997, Steve Lamont wrote:
> To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
[stuff about xforms bug]

I looked up what the actual bug was in my old email, and it concerns
xforms 0.81. The bug has probably been fixed by now.

The bug with xforms is that calling fl_set_canvas_colormap doesn't
call XSetWMColormapWindows unless [ fl_set_canvas_colormap ] is called
_before_ fl_show_form. However it's quite possible to change
colormaps after the form is shown, and if the colormap is different
than the top level window XSetWMColormapWindows needs to be called to
let the window manager know.

Basically if you install a colormap on an existing canvas (already shown), then
the property doesn't get set. TC emailed me about this back in January, so
I bet he's fixed it by now.

> > 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 spent hours tracking this down, going through fvwm2's source. Far longer
than I spent on the actual program. I could put my program up on ftp, it was
a class assignment and not very large (~500 lines total). But the damn admins
here put up a firewall, without asking anyone about it. I just pay their
salaries, what do they care about inconveniencing me? But enough ranting.

Here is the code for the relevant event handlers. They are installed on the
canvas which has the private colormap. The program DID work, both on a
single colormap linux box and a multiple colormap SGI. The QuitButton
business is a kludge to get at the top-level window.

int CanvasEnterNotify(FL_OBJECT *ob, Window win, int ww, int wh,
XEvent *xev, void *data)
{
Window wins[2];
/* notice how the canvas window is first */
wins[0]=win;
wins[1]=FL_ObjWin(fd_Mandelbrot->QuitButton);
XSetWMColormapWindows(fl_get_display(),wins[1],wins,2);
}

int CanvasLeaveNotify(FL_OBJECT *ob, Window win, int ww, int wh,
XEvent *xev, void *data)
{
Window wins[2];
/* notice the canvas window is now last! */
wins[1]=win;
wins[0]=FL_ObjWin(fd_Mandelbrot->QuitButton) ;
XSetWMColormapWindows(fl_get_display(),wins[0],wins,2);
}

|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 (xyzzy@u.washington.edu) -- Metallica |
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/