From 7e945a52f15df81edebbb4797f7fe0c2b371a45c Mon Sep 17 00:00:00 2001 From: Pete Schaffner Date: Thu, 8 Feb 2024 18:16:17 +0100 Subject: [PATCH] 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. --- .../Features/Terminal/TerminalWindow.swift | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalWindow.swift b/macos/Sources/Features/Terminal/TerminalWindow.swift index 25bf5a523..e3362300c 100644 --- a/macos/Sources/Features/Terminal/TerminalWindow.swift +++ b/macos/Sources/Features/Terminal/TerminalWindow.swift @@ -34,6 +34,21 @@ class TerminalWindow: NSWindow { // The tab bar controller ID from macOS 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 private func changedTitlebarTabs(to newValue: Bool) { if (newValue) { @@ -195,13 +210,6 @@ class TerminalWindow: NSWindow { $0.className == "NSTitlebarContainerView" }) 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, // just as it does in the stock tab bar. //