[vtkusers] VTK Cocoa mouse problem

Chris Scharver scharver at evl.uic.edu
Sun Feb 9 01:20:04 EST 2003


Hello,

I just noticed that mouse events aren't occurring in the correct place on Cocoa windows.  The easiest way to see this is to move a vtkRenderWindow to the right side of the screen. Clicking the mouse on the left side of the window generates a mouse event  with a value which makes the interactor spin to the right. The behavior is obviously incorrect.

Adding some output to the source code, I found that the initial mouse down is properly read in the relative position in the window. However, beyond that (the internal do..while loop within [vtlCocoaGLView mouseDown]) the positions are read in absolute screen coordinates. This conversion should be handled by calling convertPoint:fromView:, which the code does. The window id of the event is 0, so somehow the screen is sending the event rather than the vtkCocoaGLView.

I've copied the code into a stand-alone sample and it works fine, so there's something screwy somewhere in the VTK code. I've tried to copy application initialization and basic capabilities into a nib-less example, and everything runs fine there. I'm not sure what could be causing the problem since the same mouseDown code copied into another snippet runs fine. Any vtkCocoa developers know what may be happening?

I've been trying to track through the code to create a fix, but I haven't had any luck. It's easy to see what's happening, but not why.

Chris
--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www.evl.uic.edu/scharver/>



More information about the vtkusers mailing list