From 77031d70824032805ad43f60820973c6e2496235 Mon Sep 17 00:00:00 2001 From: Didier Korthoudt Date: Thu, 6 Oct 2016 22:54:32 +0200 Subject: [PATCH 1/2] Fixed: setFrameSize was calling _updateTrackingAreas too often --- AppKit/CPView.j | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index cadcdf356..0b1008501 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -1030,7 +1030,7 @@ var CPViewHighDPIDrawingEnabled = YES; [[self superview] viewFrameChanged:[[CPNotification alloc] initWithName:CPViewFrameDidChangeNotification object:self userInfo:nil]]; if (!_inhibitUpdateTrackingAreas) - [self _updateTrackingAreas]; + [self _updateTrackingAreasWithRecursion:YES]; } /*! @@ -1103,7 +1103,7 @@ var CPViewHighDPIDrawingEnabled = YES; #endif if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications) - [self _updateTrackingAreas]; + [self _updateTrackingAreasWithRecursion:YES]; } /*! @@ -1257,7 +1257,7 @@ var CPViewHighDPIDrawingEnabled = YES; [[self superview] viewFrameChanged:[[CPNotification alloc] initWithName:CPViewFrameDidChangeNotification object:self userInfo:nil]]; if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications) - [self _updateTrackingAreas]; + [self _updateTrackingAreasWithRecursion:!_autoresizesSubviews]; } /*! @@ -1306,7 +1306,7 @@ var CPViewHighDPIDrawingEnabled = YES; [[self superview] viewBoundsChanged:[[CPNotification alloc] initWithName:CPViewBoundsDidChangeNotification object:self userInfo:nil]]; if (!_inhibitUpdateTrackingAreas) - [self _updateTrackingAreas]; + [self _updateTrackingAreasWithRecursion:YES]; } /*! @@ -1374,7 +1374,7 @@ var CPViewHighDPIDrawingEnabled = YES; [[self superview] viewBoundsChanged:[[CPNotification alloc] initWithName:CPViewBoundsDidChangeNotification object:self userInfo:nil]]; if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications) - [self _updateTrackingAreas]; + [self _updateTrackingAreasWithRecursion:YES]; } /*! @@ -1418,7 +1418,7 @@ var CPViewHighDPIDrawingEnabled = YES; [[self superview] viewBoundsChanged:[[CPNotification alloc] initWithName:CPViewBoundsDidChangeNotification object:self userInfo:nil]]; if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications) - [self _updateTrackingAreas]; + [self _updateTrackingAreasWithRecursion:YES]; } @@ -3590,21 +3590,21 @@ setBoundsOrigin: [_trackingAreas removeObjectIdenticalTo:trackingArea]; } -- (void)_updateTrackingAreas +- (void)_updateTrackingAreasWithRecursion:(BOOL)shouldCallRecursively { _inhibitUpdateTrackingAreas = YES; - [self _recursivelyUpdateTrackingAreas]; - - _inhibitUpdateTrackingAreas = NO; -} - -- (void)_recursivelyUpdateTrackingAreas -{ [self _updateTrackingAreasForOwners:[self _calcTrackingAreaOwners]]; - for (var i = 0; i < _subviews.length; i++) - [_subviews[i] _recursivelyUpdateTrackingAreas]; + if (shouldCallRecursively) + { + // Now, call _updateTrackingAreasWithRecursion on subviews + + for (var i = 0; i < _subviews.length; i++) + [_subviews[i] _updateTrackingAreasWithRecursion:YES]; + } + + _inhibitUpdateTrackingAreas = NO; } - (CPArray)_calcTrackingAreaOwners From e0fab808b96c440ba82b101819257189f581d22d Mon Sep 17 00:00:00 2001 From: Didier Korthoudt Date: Sat, 8 Oct 2016 17:33:21 +0200 Subject: [PATCH 2/2] fix-overlappingTA-could-be-empty --- AppKit/CPWindow/CPWindow.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 380b2b149..fd1a0b469 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -4098,6 +4098,9 @@ var interpolate = function(fromValue, toValue, progress) [overlappingTrackingAreas addObject:aTrackingArea]; } + if (overlappingTrackingAreas.length === 0) + return; + var frontmostTrackingArea = overlappingTrackingAreas[0], frontmostView = [frontmostTrackingArea view];