new: support for releasedWhenClosed in CPWindow

This commit is contained in:
daboe01
2023-12-23 19:08:38 +01:00
parent ae1a39322e
commit f642330306
2 changed files with 15 additions and 0 deletions
+11
View File
@@ -44,6 +44,7 @@
@class CPClipView
@class CPScrollView
@class CALayer
@class CPBinder
@global appkit_tag_dom_elements
@@ -3732,6 +3733,16 @@ var CPAppearanceVibrantDark = [CPAppearance appearanceNamed:CPAppearanceNameVibr
[owners[i] updateTrackingAreas];
}
// needed by CPWindow's releasedWhenClosed property
- (void)_releaseRecursively
{
[_subviews makeObjectsPerformSelector:@selector(_releaseRecursively)];
[self _removeObservers];
[CPBinder unbindAllForObject:self];
[self removeFromSuperview];
}
@end
var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
+4
View File
@@ -186,6 +186,7 @@ var CPWindowActionMessageKeys = [
BOOL _constrainsToUsableScreen;
unsigned _shadowStyle;
BOOL _showsResizeIndicator;
BOOL _releasedWhenClosed @accessors(property=releasedWhenClosed);
int _positioningMask;
CGRect _positioningScreenRect;
@@ -2534,6 +2535,9 @@ CPTexturedBackgroundWindowMask
[_parentWindow removeChildWindow:self];
[self _orderOutRecursively:NO];
[self _detachFromChildrenClosing:!_parentWindow];
if (_releasedWhenClosed)
[_contentView _releaseRecursively];
}
- (void)_detachFromChildrenClosing:(BOOL)shouldCloseChildren