NSTrackingArea: store the userInfo and use the AppKit option values#500
Open
DTW-Thalion wants to merge 1 commit into
Open
NSTrackingArea: store the userInfo and use the AppKit option values#500DTW-Thalion wants to merge 1 commit into
DTW-Thalion wants to merge 1 commit into
Conversation
initWithRect:options:owner:userInfo: retained the (nil) ivar instead of the userInfo argument, so -userInfo always returned nil. The NSTrackingAreaOptions constants were also packed contiguously from 0x08, where AppKit leaves 0x08 unused: the active options start at 0x10 and the rest follow. Fix both and add tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two AppKit-alignment fixes in NSTrackingArea, found by adding coverage for it.
initWithRect:options:owner:userInfo: did
_userInfo = RETAIN(_userInfo), retaining the still-nil ivar instead of the userInfo argument, so -userInfo always returned nil even though the dictionary was passed in.The NSTrackingAreaOptions constants were numbered contiguously from 0x08 (ActiveWhenFirstResponder=0x08, ActiveInKeyWindow=0x10, ... EnabledDuringMouseDrag=0x200). AppKit leaves 0x08 unused: the active options start at 0x10 and run 0x10/0x20/0x40/0x80, then 0x100/0x200/0x400. Verified against Cocoa on macOS. The only in-tree use is the NSTrackingAssumeInside check in initWithRect:, which reads the named constant and stays correct.
The new test covers the option values, the rect/options/owner/userInfo accessors, a nil userInfo and copy.