don@BRILLIG.UMD.EDU (Don Hopkins) (10/16/87)
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?
-Donaronson%sungod.tcpip@GE-CRD.ARPA (10/26/87)
Received: by sungod.steinmetz (3.2/1.1x Steinmetz) id AA22984; Mon, 19 Oct 87 08:50:26 EDT Date: Mon, 19 Oct 87 08:50:26 EDT From: marc aronson <aronson@sungod> Posted-Date: Mon, 19 Oct 87 08:50:26 EDT Message-Id: <8710191250.AA22984@sungod.steinmetz> To: don@BRILLIG.UMD.EDU Subject: Re: Mouse event coordinates getting screwed up upon window resize Newsgroups: comp.windows.news In-Reply-To: <8710160532.AA23176@brillig.umd.edu> 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 aronson@ge-crd.arpa -- steinmetz!sungod!aronson