kludge for colormap problem

Trent Piepho (xyzzy@u.washington.edu)
Thu, 16 Jan 1997 15:33:59 -0800 (PST)

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

By examining xmag and fvwm I've found a kludge to work around the problem
of having a canvas with a different colormap. From what I can tell this is
a window manager bug, but it's not clear that the behavior isn't totally
unreasonable.

First, is there a standard way of getting the window id of the top-level
window? I used FL_ObjWin for an object in the window, but that's just a hack.

In order to get the colormap set correctly it's necessary to install handlers
for EnterNotify and ExitNotify events. These handlers need to set the
WM_COLORMAP_WINDOWS property. The first member should be the window which
has the colormap you want intalled. Example:

int CanvasEnterNotify(FL_OBJECT *ob, Window win, int ww, int wh,
XEvent *xev, void *data)
{
Window wins[2];
wins[0]=win;
wins[1]=FL_ObjWin(fd_Main->Button); /* top level window */
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];
wins[0]=FL_ObjWin(fd_Main->Button); /* top level window */
wins[1]=win;
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 |