Move separator hiding back into updateConstraintsIfNeeded

I moved this into `update` when doing the tab bar background coloring
but the separators would still show briefly.
This commit is contained in:
Pete Schaffner
2024-02-08 18:16:17 +01:00
parent 95c8541efd
commit 7e945a52f1

View File

@ -34,6 +34,21 @@ class TerminalWindow: NSWindow {
// The tab bar controller ID from macOS // The tab bar controller ID from macOS
static private let TabBarController = NSUserInterfaceItemIdentifier("_tabBarController") static private let TabBarController = NSUserInterfaceItemIdentifier("_tabBarController")
// Look through the titlebar's view hierarchy and hide any of the internal
// views used to create a separator between the title/toolbar and unselected
// tabs in the tab bar.
override func updateConstraintsIfNeeded() {
super.updateConstraintsIfNeeded()
guard let titlebarContainer = contentView?.superview?.subviews.first(where: {
$0.className == "NSTitlebarContainerView"
}) else { return }
for v in titlebarContainer.descendants(withClassName: "NSTitlebarSeparatorView") {
v.isHidden = true
}
}
/// This is called by titlebarTabs changing so that we can setup the rest of our window /// This is called by titlebarTabs changing so that we can setup the rest of our window
private func changedTitlebarTabs(to newValue: Bool) { private func changedTitlebarTabs(to newValue: Bool) {
if (newValue) { if (newValue) {
@ -195,13 +210,6 @@ class TerminalWindow: NSWindow {
$0.className == "NSTitlebarContainerView" $0.className == "NSTitlebarContainerView"
}) else { return } }) else { return }
// Look through the titlebar's view hierarchy and hide any of the internal
// views used to create a separator between the title/toolbar and unselected
// tabs in the tab bar.
for v in titlebarContainer.descendants(withClassName: "NSTitlebarSeparatorView") {
v.isHidden = true
}
// Color the new tab button's image to match the color of the tab title/keyboard shortcut labels, // Color the new tab button's image to match the color of the tab title/keyboard shortcut labels,
// just as it does in the stock tab bar. // just as it does in the stock tab bar.
// //