[vtk-developers] Changes to the Carbon and Cocoa interactors

Sean McBride sean at rogue-research.com
Sun Jan 10 17:40:46 EST 2010


On 12/17/09 9:18 AM, David Gobbi said:

>We just finished a slew of changes to the RenderWindowInteractors for
>Carbon and Cocoa.  The main goal was to fill the missing features of
>these classes wrt the X and Win32 interactors.  People who rely on
>these classes should test them to make sure that their applications
>still behave as expected. Briefly, the new behaviors of these classes
>are as follows:

David,

I have a two other comments about the changes that I did not mention
before (since they are more complicated...)

1) You store the return value of addTrackingRect: in the
rolloverTrackingRectTag ivar (fine), but you assume that it will only
return positive values (see clearTrackingRect).  No doubt this is the
case currently, but I can't find anything in the docs to indicate that
this can be assumed.  Maybe I've just missed it?

2) Why did you decide to use resetCursorRects to add/remove the tracking
rects?  It doesn't seem to be the typical purpose of resetCursorRects. 
OTOH, from the googling I've done, this is perhaps the best place. 
IMNSHO, Apple's addTrackingRect: API is broken.  An example is this
statement from Apple's docs:

<http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/
EventOverview/MouseTrackingEvents/MouseTrackingEvents.html>

"Although NSView implements the addTr
ackingRect:owner:userData:assumeInside: method, a view's window
maintains the list of tracking rectangles. When a view's initWithFrame:
initializer is invoked, the view is not yet associated with a window, so
the tracking rectangle cannot yet be added to the window's list. Thus
the best place to add tracking rectangles initially is in the
viewDidMoveToWindow method."

10.5 introduced a new class NSTrackingArea which addresses these
problems, notably "An NSTrackingArea object belongs to its view rather
than to its window. Consequently, you can add and remove tracking
rectangles without needing to worry if the view has been added to a window"

I propose we:
A) stick with what we have (but fix #1 above by changing your "> 0" to "!
= 0").
or
B) Increase VTK's minimum requirement to Mac OS X 10.5 and use the newer
cleaner APIs.

Thoughts?

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada





More information about the vtk-developers mailing list