Use explicit constraints for the titlebar bg view
Easier to reason about
This commit is contained in:
parent
791902caad
commit
b6f9080486
1 changed files with 11 additions and 1 deletions
|
|
@ -3297,11 +3297,21 @@ void clear_title_bar_background_views(NSWindow *window) {
|
|||
debug_rendering("titlebar_height used for translucent titlebar view: %f\n", height);
|
||||
NSView *bgView = [[NSView alloc] initWithFrame:NSMakeRect(
|
||||
0, titlebarContainer.bounds.size.height - height, titlebarContainer.bounds.size.width, height)];
|
||||
bgView.autoresizingMask = NSViewWidthSizable | NSViewMinYMargin;
|
||||
bgView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
bgView.wantsLayer = YES;
|
||||
bgView.layer.backgroundColor = backgroundColor.CGColor;
|
||||
bgView.identifier = tag;
|
||||
[contentView addSubview:bgView];
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
// Pin to the top of the content view.
|
||||
[bgView.topAnchor constraintEqualToAnchor:titlebarContainer.topAnchor],
|
||||
// Pin to the leading edge of the content view.
|
||||
[bgView.leadingAnchor constraintEqualToAnchor:titlebarContainer.leadingAnchor],
|
||||
// Pin to the trailing edge of the content view.
|
||||
[bgView.trailingAnchor constraintEqualToAnchor:titlebarContainer.trailingAnchor],
|
||||
// Give it a fixed height
|
||||
[bgView.heightAnchor constraintEqualToConstant:height]
|
||||
]];
|
||||
[bgView release];
|
||||
#undef tag
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue