macos: small stylistic edits

This commit is contained in:
Mitchell Hashimoto
2024-02-05 19:04:50 -08:00
parent 1d6b952c8f
commit 3c0317bf9d
2 changed files with 3 additions and 5 deletions

View File

@ -140,7 +140,7 @@ class TerminalController: NSWindowController, NSWindowDelegate,
} }
} }
func fixTabBar() { private func fixTabBar() {
// We do this to make sure that the tab bar will always re-composite. If we don't, // We do this to make sure that the tab bar will always re-composite. If we don't,
// then the it will "drag" pieces of the background with it when a transparent // then the it will "drag" pieces of the background with it when a transparent
// window is moved around. // window is moved around.

View File

@ -29,6 +29,7 @@ class TerminalWindow: NSWindow {
private var windowButtonsBackdrop: NSView? = nil private var windowButtonsBackdrop: NSView? = nil
private var windowDragHandle: WindowDragView? = nil private var windowDragHandle: WindowDragView? = nil
private var storedTitlebarBackgroundColor: CGColor? = nil
// 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")
@ -65,8 +66,6 @@ class TerminalWindow: NSWindow {
} }
} }
private var storedTitlebarBackgroundColor: CGColor? = nil
// Assign a background color to the titlebar area. // Assign a background color to the titlebar area.
func setTitlebarBackground(_ color: CGColor) { func setTitlebarBackground(_ color: CGColor) {
storedTitlebarBackgroundColor = color storedTitlebarBackgroundColor = color
@ -80,9 +79,8 @@ class TerminalWindow: NSWindow {
} }
// Make sure the titlebar has the assigned background color. // Make sure the titlebar has the assigned background color.
func restoreTitlebarBackground() { private func restoreTitlebarBackground() {
guard let color = storedTitlebarBackgroundColor else { return } guard let color = storedTitlebarBackgroundColor else { return }
setTitlebarBackground(color) setTitlebarBackground(color)
} }