On Monday 29 August 2005 22:07, Sergey Plis wrote: > Hello! > > Here is a possible bug related to transferring mouse clicks to opengl > canvas. I have the code with follows after this message. It has three > glcanvas objects. Each canvas has unique mouse-click reaction. However, > when I run the code only the first defined click reaction (i.e. > printing out ." zx") is executed, no matter on which out of those 3 > canvases I click.
Found it. The window-stub doesn't translate the click coordinates relatively
to the main window.
Define a method transclick in the displays class (screen 64). Change screen
92 to
\ Display 30aug05py
:noname \ cr ." mapping notify"
event XRefreshKeyboardMapping drop ;
MappingNotify cells Handlers + !
: click^ ( -- event ) clicks @ @+ swap 8* + ;
: transclick ( x y -- x' y' ) ;
: sendclick ( count event -- ) pending on click^ >r
dup XButtonEvent state @ swap
dup XButtonEvent button @ swap >r $80 swap << xor r>
dup XButtonEvent x @ swap
XButtonEvent y @ transclick swap
r> w!+ w!+ w!+ w! ;
: !xyclick ( event -- ) click^ >r
dup XButtonEvent x @ swap
XButtonEvent y @ transclick swap r> w!+ w! ;
(i.e. use transclick there).
Add a redefinition of transclick on Screen 368 (class window-stub):
: transclick ( x y -- x' y' ) x @ y @ p+ ;
Then you get the correct responses.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/
pgpfyJ9EYPxF4.pgp
Description: PGP signature
