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.
This commit is contained in:
Qwerasd
2024-02-05 17:05:13 -05:00
parent 878b5be185
commit 1d6b952c8f

View File

@ -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) { @objc private func onFrameDidChange(_ notification: NSNotification) {
// This is a huge hack to set the proper shortcut for tab selection // 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. // on tab reordering using the mouse. There is no event, delegate, etc.
@ -335,6 +347,11 @@ class TerminalController: NSWindowController, NSWindowDelegate,
func windowDidBecomeKey(_ notification: Notification) { func windowDidBecomeKey(_ notification: Notification) {
self.relabelTabs() 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 // Called when the window will be encoded. We handle the data encoding here in the