AppKit cursorRects does not fall back to NSTrackingArea based cursorUpdate when popping last cursor

Originator:torarnv
Number:rdar://34183708 Date Originated:
Status:Open Resolved:
Product:AppKit Product Version:10.12.6
Classification:Bug Reproducible:Always
 
There's two APIs to do cursor handling in AppKit today:

 - The legacy cursorRect approach https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/MouseTrackingEvents/MouseTrackingEvents.html
 - The new NSTrackingArea based approach https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/TrackingAreaObjects/TrackingAreaObjects.html

-[NSApplication _handleCursorRectEvent:] calls [[NSCursor arrowCursor] set] when the cursor stack is emptied, instead of falling back to allowing the event to propagate into a -[NSView cursorUpdate:] .

Steps to Reproduce:
This can be seen when for example putting a NSTextField (which still uses the legacy API), into a NSView with an NSTrackingArea and cursorUpdate overriden to set a hand cursor e.g.. 

-[NSView cursorUpdate:] is called when the cursor enters the root view, as expected, and NSDebugCursorRects shows that a cursor rect is pushed onto the stack when entering the text field and changing the cursor into an I-bream, but when the cursor then leaves the text field, the cursor rect is popped, and the arrow cursor is set, never calling -[NSView cursorUpdate:].

Expected Results:
Moving the mouse from the text field to the root view restores the root view's cursor via -[NSView cursorUpdate:]

Observed Results:
The cursor is reset to the arrow cursor.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!