My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 482: ToolTips (and now TrackingAreas) again
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jan 2010


Sign in to add a comment
 
Reported by m...@jump-ing.de, Jan 6, 2010
What steps will reproduce the problem?

Sometimes, ToolTips of the main window would show up over a just opened sheet and there's no 
way to get these ToolTips going away.

After looking into the issue I came to the conclusion, storing CursorRects, TrackingRects, 
ToolTips and the like in NSWindow is the wrong place. As they belong to views, they should be 
stored in NSView. _After_ that conclusion I hat a look at Snow Leopard's API documentation and 
found new stuff there. Obviously, Apple folks came to the same conclusion.


What version of the product are you using? On what operating system?

r707 for Win32


Please provide any additional information below.

Please find the patch attached. Due to a temporal lack on focus the patch is 3000+ lines, though. 
In essence, it replaces legacy CursorRects, ToolTips and TrackingRects with well-crafted versions 
of the newer TrackingAreas. Only few tweaks are needed to keep compatibility.

To get TrackingAreas to work, NSWindow fetches them on demand from the attached view 
hierarchy, converting the frame in the process.

Let me go into the details:


NSWindow.h:

Completed to contain declarations of all Apple documented methods along with the required 
enums.


NSWindow.m:

Template implementations for all the new API.

Storage and all handling of CursorRects and TrackingRects removed. Quite a few methods 
vanished.

Rewrote -invalidateCursorRectsForView, -resetCursorRects and -discardCursorRects to make use 
of the corresponding partners in NSView.

The TrackingArea fetching system in -_updateTrackingAreas and -_resetTrackingAreas.

Rewrote -platformWindowSetCursorEvent to handle TrackingAreas with all their options. No 
special handling of legacy cursorRects or thelike needed. Even overlapping ToolTip rects work 
now.


NSView.h

Completed to contain declarations of all Apple documented methods along with the required 
enums.


NSView.m:

Template implementations for all the new API.

Replaced all ToolTip, TrackingArea and CursorRect methods to make use of TrackingRects.

Added -_hiddenHitTest for out-of order hit tests. Cocoa's -hitTest is well known to be used only 
on mouse clicks and overridden often for intentional side effects. However, TrackingAreas need 
this functionality on mouse movements as well.


NSTrackingArea.h:

Reviewed for API completenes against 10.6 as well.

Added a few markers to keep track of the current use of the TrackingArea.


NSTrackingArea.m:

Accessors for the above.


NSCursorRect.h/.m:

NSCursorRects are now used as owner of TrackingAreas which want to change the cursor. One 
method, ripped off the other stuff.


NSToolTipWindow.h/.m:

Can figure it's location now on it's own.

Added storage for a NSTrackingArea which helps NSWindow to avoid bad side effects of 
overlapping ToolTip rects.

Added support for the NSToolTipAutoWrappingDisabled preference.


NSEvent.h/.m, NSEvent_mouse.h/.m:

Add initializers for mouseEntered:, mouseMoved: and mouseExited: events.

Added +currentModifierFlags.


NSDisplay.h/.m:

Added -currentModifierFlags.


NSResponder.h/.m:

Added -cursorUpdate:, fixed a few warnings.


Win32Window.m:

Removed some duplicate code.


NSSplitView.m:

Fixed a warning.

Reduced the impact of a hack.

- - -

All this is tested with TrackingAreas, ToolTips and CursorRects on a real-world application. It 
works beautiful.

I'm well aware such huge patches aren't the best way to make friends in the open source world, 
but getting this into a bunch of each-works-on-ints-own parts would likely be another two or 
three days of work.

Nevertheless, if there are some parts which shouldn't go into Cocotron or if there are mistakes in 
the new code, I'll happily rework the patch.


Best wishes for 2010.


TrackingAreaPatch.txt
97.7 KB   View   Download
Jan 7, 2010
Project Member #1 cjwll...@gmail.com
This issue was closed by revision r713.
Status: Fixed
Mergedinto: -
Sign in to add a comment

Powered by Google Project Hosting