[vtkusers] VTK Cocoa mouse problem

Chris Scharver scharver at evl.uic.edu
Mon Feb 10 10:55:32 EST 2003


At 10:33 AM +0100 02/10/2003, Drew McCormack wrote:
>I came across the same problem several months ago, but haven't had a shot at tracking it down. I just implemented a hack, by creating a category, copying the mouse event code, and adding the following line to each mouse-event method:
>
>NSPoint mouseLoc = [self convertPoint:[[self window] convertScreenToBase:[theEvent locationInWindow]] fromView:nil];
>
>I think you probably have done the same, right? Just like you, I do not understand why this would be necessary. As you say, events are being interpreted relative to the screen instead of the view. Why, I don't know.
>
>If you find the problem, I would love to hear it.

I hadn't managed to put a fix into place. I've been spending a lot much time tediously trying to track down why the screen is capturing the events. Your fix does fix the dragging, but the last mouse-up which terminates that internal loop is then read at the wrong position.

At long last, I just managed to track down the cause of the problem... vtkCocoaRenderWindowInteractor::CreateTimer() does the following:

    [NSEvent stopPeriodicEvents];
    [NSEvent startPeriodicEventsAfterDelay:0.01 withPeriod:0.01];

If that's commented out, then events occur normally. I'm checking with Apple's engineers to see if this is the correct behavior. It's a real sense of vindication to finally find it. :)

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