diff --git a/AppKit/CPTrackingArea.j b/AppKit/CPTrackingArea.j index 3f262683e..0b422b1c3 100644 --- a/AppKit/CPTrackingArea.j +++ b/AppKit/CPTrackingArea.j @@ -23,16 +23,17 @@ @import @import "CPView.j" +/* @group CPTrackingAreaOptions */ @typedef CPTrackingAreaOptions -CPTrackingMouseEnteredAndExited = 1 << 1, -CPTrackingMouseMoved = 1 << 2, -CPTrackingCursorUpdate = 1 << 3, -CPTrackingActiveWhenFirstResponder = 1 << 4, -CPTrackingActiveInKeyWindow = 1 << 5, -CPTrackingActiveInActiveApp = 1 << 6, -CPTrackingActiveAlways = 1 << 7, -CPTrackingAssumeInside = 1 << 8, -CPTrackingInVisibleRect = 1 << 9, +CPTrackingMouseEnteredAndExited = 1 << 1; +CPTrackingMouseMoved = 1 << 2; +CPTrackingCursorUpdate = 1 << 3; +CPTrackingActiveWhenFirstResponder = 1 << 4; +CPTrackingActiveInKeyWindow = 1 << 5; +CPTrackingActiveInActiveApp = 1 << 6; +CPTrackingActiveAlways = 1 << 7; +CPTrackingAssumeInside = 1 << 8; +CPTrackingInVisibleRect = 1 << 9; CPTrackingEnabledDuringMouseDrag = 1 << 10; var CPTrackingAreaRectKey = @"CPTrackinkAreaRectKey", diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 36656fdf8..05bf3cc45 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -3535,7 +3535,7 @@ setBoundsOrigin: // We also do special treatment and notify the view itself if it has no tracking area to // enable the use of updateTrackingAreas as a mean to install tracking areas. - if (_trackingAreas.length > 0) + if ([_trackingAreas count] > 0) var ownersToNotify = [self _prepareOwnersToNotify]; else var ownersToNotify = @[ self ]; @@ -3551,7 +3551,7 @@ setBoundsOrigin: var ownersToNotify = []; - for (var i = 0; i < _trackingAreas.length; i++) + for (var i = 0, count = [_trackingAreas count]; i < count; i++) { var trackingArea = _trackingAreas[i]; @@ -3626,6 +3626,11 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", if (self) { + _trackingAreas = [aCoder decodeObjectForKey:CPViewTrackingAreasKey]; + + if (!_trackingAreas) + _trackingAreas = []; + // We have to manually check because it may be 0, so we can't use || _tag = [aCoder containsValueForKey:CPViewTagKey] ? [aCoder decodeIntForKey:CPViewTagKey] : -1; _identifier = [aCoder decodeObjectForKey:CPReuseIdentifierKey]; @@ -3699,11 +3704,6 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", [self setAppearance:[aCoder decodeObjectForKey:CPViewAppearanceKey]]; - _trackingAreas = [aCoder decodeObjectForKey:CPViewTrackingAreasKey]; - - if (!_trackingAreas) - _trackingAreas = []; - [self setNeedsDisplay:YES]; [self setNeedsLayout]; }