Skip to content

NSTrackingArea: store the userInfo and use the AppKit option values#500

Open
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/nstrackingarea-userinfo-options
Open

NSTrackingArea: store the userInfo and use the AppKit option values#500
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/nstrackingarea-userinfo-options

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

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.

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.
@DTW-Thalion DTW-Thalion requested a review from fredkiefer as a code owner July 12, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant