juancho@dgp.toronto.edu (John Buchanan) (04/14/89)
a window rather than in absolute screen coordinates? The code that I have
now looks like this.
switch(qread(&val))
{
case REDRAW: /* Reset window offsets */
getorigin(&xorg,&yorg);
break;
case LEFTMOUSE: /* Get the mouse in window */
X = getvaluator(MOUSEX) - xorg;
Y = getvaluator(MOUSEY) - yorg;
break;
}
I cannot even imagine the thinking which led to the line drawing occuring
in window coordinates but the mouse tracking only in screen coordinates.
John W. Buchanan Dynamic Graphics Project
Computer Systems Research Institute
University of Toronto
(416) 978-6619 Toronto, Ontario M5S 1A4
BITNET: juancho@explorer.dgp.utoronto
EAN: juancho@explorer.dgp.toronto.cdn
UUCP: ...!explorer.dgp.toronto.edu!juancho
andru@rhialto.SGI.COM (Andrew Myers) (04/15/89)
In article <8904141229.AA24616@explorer.dgp.toronto.edu>, juancho@dgp.toronto.edu (John Buchanan) writes: > Is there any way to determine the location of a mouse relative to > a window rather than in absolute screen coordinates? The code that I have > now looks like this. [ a valid solution to the problem ] > I cannot even imagine the thinking which led to the line drawing occuring > in window coordinates but the mouse tracking only in screen coordinates. Actually, line drawing doesn't occur in window coordinates; it occurs in world coordinates. In a pixel-oriented paradigm, the two are the same; however, SGI uses a 3D paradigm, and they are quite different. As far as getting window-relative mouse coordinates, it seems like a decision fraught with trade-offs. The only real issue is programmer ease/confusion; as you've demonstrated, it's easy enough to translate screen coordinates to window coordinates. Personally, I prefer to get the coordinates in an absolute system, because it reduces confusion for me, especially when writing multi- window programs. De gustibus non est disputandum. > > > John W. Buchanan Dynamic Graphics Project > Computer Systems Research Institute > University of Toronto > (416) 978-6619 Toronto, Ontario M5S 1A4 > Andrew Myers
msc@ramoth.SGI.COM (Mark Callow) (04/17/89)
In article <8904141229.AA24616@explorer.dgp.toronto.edu>, juancho@dgp.toronto.edu (John Buchanan) writes: > Is it possible to get mouse coordinates in window relative > rather than in absolute screen coordinates? The code that I have > now looks like this. > > switch(qread(&val)) > { > case REDRAW: /* Reset window offsets */ > getorigin(&xorg,&yorg); > break; > case LEFTMOUSE: /* Get the mouse in window */ > X = getvaluator(MOUSEX) - xorg; > Y = getvaluator(MOUSEY) - yorg; > break; > } > > I cannot even imagine the thinking which led to the line drawing occuring > in window coordinates but the mouse tracking only in screen coordinates. > No thinking went into deciding it should be that way. The IRIS was originally developed without a window system and the input system was designed in that environment. What we have now is the result of the great God compatibility. I'm considering designing a new input subsystem. I believe that input should be given in your current coordinate system. Send me your ideas. -- -Mark