Subject: Mouse event coordinates getting screwed up upon window resize

From: Don Hopkins <[email-masked]>
Date: Fri, 16 Oct 87 00:51:01 EST

I wrote a psh script that made a subclass of DefaultWindow, that
forked an event manager which would listen for mouse events on the
clientcanvas, and draw things at the coordinates of the events. Once I
resized the window, though, the coordinates of all the events would
all be off by some translation.

I finally got it to work right by making an instance variable:

  /ClientCanvasMatrix null def

And overriding the /ShapeClientCanvas method:

  /ShapeClientCanvas { % - => - ([Re]set client canvas' shape)
    /ShapeClientCanvas super send
    gsave
      ClientCanvas setcanvas
      ClientCanvasMatrix null eq {
        /ClientCanvasMatrix matrix def
      } if
      ClientCanvasMatrix currentmatrix
    grestore
  } def

And inserting in the beginning of each function that handled an event:

    ClientCanvasMatrix setmatrix

I think it has something to do with the fact that the process that is
reshaping the window (thus altering the CTM) is different that the one
doing the drawing. Isn't the CTM a part of the graphics state, which
is a part of the process, as opposed to the canvas?

Does anybody know what's really going on, and if there's a way to go
about things so that this is not a problem? (How about adding my
client's interests to the frame interests, so they are all handled by
the same process?) Should each window have a CTM (or a whole graphics
state) as an instance variable?

	-Don

---

From: [email-masked]
Date: Mon, 26 Oct 87 02:15:50 EST

Date: Mon, 19 Oct 87 08:50:26 EDT
From: marc aronson <aronson@sungod>
To: [email-masked]
Subject: Re: Mouse event coordinates getting screwed up upon window resize
In-Reply-To: <[email-masked]>
Organization: General Electric CRD, Schenectady, NY
Cc:

I had some problems with screwed up coordinates comeing off a canvas in an
event process.  I solved it by executing a "setcanvas" EVERY time the
event process woke up.  It seems that a given process will see the
"old" graphics state associated w/ a canvas until the process has done
another 'setcanvas'.  I'm not certain that this is the same problem
your observing, but I figured I'd throw in my 2-cents worth.

--
Marc Aronson

[email-masked] -- steinmetz!sungod!aronson