[vtk-developers] Changes to the Carbon and Cocoa interactors
Sean McBride
sean at rogue-research.com
Mon Jan 11 17:21:39 EST 2010
On 1/11/10 12:58 PM, David Gobbi said:
>> 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?
>
>As far as I could find in the docs, there are no invalid values for
>NSTrackingRectTag, so we have to assume that even zero is a valid tag.
> I've added a separate boolean ivar to handle this.
You are absolutely correct regarding 0. (Though in practice, it's
probably OK since even Apple's sample code treats zero specially.) Ex:
<http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/
EventOverview/MouseTrackingEvents/MouseTrackingEvents.html>
>> 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:
>
>It's there because Yves saw some similar example code. And, yeah, it
>seems like a good place for it, even if the documentation isn't
>specific.
Agreed.
>> 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"
>
>Kitware still has dashboard machines running 10.3, so we need to beg
>them to upgrade those machines and give us permission to update the
>Cocoa code to the newer future-proof APIs.
Well, if the VTK ARB (or kitware, or whoever) insist on 10.3 support, we
could open a bug to remind us to migrate to NSTrackingArea when 10.5
eventually becomes the minimum requirement.
>A related slightly broken item is the HideCursor/ShowCursor in
>vtkCocoaRenderWindow. It hides the cursor globally, but could instead
>just set a "blank" cursor like the X11 window does, so that the rects
>would only blank the cursor while it was inside the window.
That sounds like a nice change too.
>> 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.
>
>I have committed fix (A), since I don't have the authority for (B).
>But hopefully, someday, it will happen.
I reviewed this change, looks good.
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