Re: XForms: separate colormap for canvas - problems

Trent Piepho (xyzzy@u.washington.edu)
Wed, 26 Nov 1997 03:14:05 -0800 (PST)

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

On Mon, 24 Nov 1997, Michal Szymanski wrote:
> To subscribers of the xforms list from msz@bulge.astrouw.edu.pl (Michal Szymanski) :
> > I still don't think it's an XForms bug, per se, but a tvtwm bug. I'm
> > running R5 tvtwm patchlevel 10. Perhaps it's been fixed since then.
> > I've looked around for an R6 version but haven't seen one. If anyone
> > knows of a later one, please point me at it.
>
> Well, I think it might be XForms-related thing. I tried Solaris' "olvm"
> - same behavior. Normally I use "twm" (Solaris 2.5.1 and Linux XFree86
> 3.3).

The bug is with the window manager. The problem is that it isn't really a
"bug". I tried to fix fvwm's colormap handling, but once you investigate
the issue deeper, it's not so clear how things should work.

> 1. When I associate the private colormap not only with my image canvas
> window but also with main form window (through XSetWindowColormap), the
> problem disappears - the colormap gets (un)installed without any

The problem is only when you have a non-top-level window (like a canvas inside
your form) that has a private colormap. If a top-level window has a private
colormap, then everything is fine. The window manager is watching for the
mouse entering and leaving top level windows, and it installs the proper
colormap when this happens. The window manager doesn't care or get told when
the mouse enters the canvas inside the form, and consequently doesn't install
the colormap for you.

> fiddling with WM properties. Actually this is (for me) even better
> solution, as I prefer to see right colors in my image canvas also when
> the mouse is anywhere in the main form of my program.

Usually this is what people do. The problem is that xforms needs some colors
for itself. If you want your canvas to be able to set all 256 colors to
specific values, you can't do this.

> 2. This is something I do not quite understand: In the original attempt
> to install the private colormap only for image canvas (and not for main
> form window), I was very surprised to find that the same colormap gets
> installed for two other objects on my main form: another canvas
> displaying a small magnified area of my image (around the mouse in the
> main image canvas) and in a small pixmap with the whole (zoomed) image
> and a rectangle showing which part of the image is currently displayed
> in main canvas. Needless to say that I did not do anything to change
> the colormap for anything else but the main image canvas. Strange!

When you install a colormap, all windows are going to be displayed with
that colormap. So if some other window happens to have a colormap that
is the same as the one installed, it will look "correct". If you start up
a second copy of your program with the same image, you'll probably see this
effect too.

|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/