Re: XForms: colormaps and canvases

Stephen Langer (langer@cam.nist.gov)
Fri, 31 Oct 1997 13:00:53 -0500 (EST)

To subscribers of the xforms list from langer@cam.nist.gov (Stephen Langer) :

>
> To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
> Since Canvas has to clean up after itself when it goes away, I'm not
> sure that there is a good way to handle this problem other than to use
> the screen's default Colormap (which doesn't get blown away by
> XFreeColormap()).

Couldn't the canvas remember whether fl_set_canvas_colormap()
has been used, and if it has, assume that cleaning up the colormap
is the user's responsibility? The user made the colormap, so the
user should be the one to destroy it. The canvas window can be
closed without freeing the colormap.

MHO is that there should be an fl_free_colormap() to complement
fl_create_colormap(), and that XForms should otherwise not call
XFreeColormap() at all.

>
> About the only other thing I can think of is to fake out XForms by
> assigning the DefaultColormap or some other bogus Colormap to the
> canvas just before you delete it, but this is a really disgusting,
> ugly hack.
>

I might do that. It's ugly, but it's not as ugly as keeping two
colormaps synchronized or forcing the colormap of the form to match the
colormap of the canvases. Your solution has the very big advantage of
keeping the hack encapsulated with the rest of the canvas handling code.

Many thanks,
Steve

-- 
-- EMail: stephen.langer@nist.gov                    Phone: (301) 975-5423 --
-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/    Fax:   (301) 990-4127 --
-- Mail: Building 820 Room 365; NIST; Gaithersburg, Md          20899-0001 --
_________________________________________________
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/