Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!cit-vax!ucla-cs!zen!ucbvax!BRILLIG.UMD.EDU!don From: don@BRILLIG.UMD.EDU (Don Hopkins) Newsgroups: comp.windows.news Subject: Mouse event coordinates getting screwed up upon window resize Message-ID: <8710160532.AA23176@brillig.umd.edu> Date: Fri, 16-Oct-87 01:51:01 EDT Article-I.D.: brillig.8710160532.AA23176 Posted: Fri Oct 16 01:51:01 1987 Date-Received: Sat, 17-Oct-87 18:33:09 EDT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 39 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