From 1d6b952c8fa1b6741d70420f47754cd8137553e8 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Mon, 5 Feb 2024 17:05:13 -0500 Subject: [PATCH] fix(macOS): Improve updating of transparent titlebar tabs backgrounds FAR from a perfect fix, as the background seen through the tabs during window drags will be behind by a frame or so still, but definitely a vast improvement over not updating at all. --- .../Features/Terminal/TerminalController.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 080f2d871..f9ab6cfc7 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -140,6 +140,18 @@ class TerminalController: NSWindowController, NSWindowDelegate, } } + func fixTabBar() { + // 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 + // window is moved around. + // + // There might be a better way to make the tab bar "un-lazy", but I can't find it. + if let window = window, !window.isOpaque { + window.isOpaque = true + window.isOpaque = false + } + } + @objc private func onFrameDidChange(_ notification: NSNotification) { // This is a huge hack to set the proper shortcut for tab selection // on tab reordering using the mouse. There is no event, delegate, etc. @@ -335,6 +347,11 @@ class TerminalController: NSWindowController, NSWindowDelegate, func windowDidBecomeKey(_ notification: Notification) { self.relabelTabs() + self.fixTabBar() + } + + func windowDidMove(_ notification: Notification) { + self.fixTabBar() } // Called when the window will be encoded. We handle the data encoding here in the