macos: fix up some sequoia regressions
parent
a7df90ee55
commit
8cfc904c0c
|
|
@ -173,13 +173,7 @@ class TerminalWindow: NSWindow {
|
|||
return childViewController.identifier == Self.tabBarIdentifier
|
||||
}
|
||||
|
||||
/// Ensures we only run didAppear/didDisappear once per state.
|
||||
private var tabBarDidAppearRan = false
|
||||
|
||||
private func tabBarDidAppear() {
|
||||
guard !tabBarDidAppearRan else { return }
|
||||
tabBarDidAppearRan = true
|
||||
|
||||
// Remove our reset zoom accessory. For some reason having a SwiftUI
|
||||
// titlebar accessory causes our content view scaling to be wrong.
|
||||
// Removing it fixes it, we just need to remember to add it again later.
|
||||
|
|
@ -189,10 +183,11 @@ class TerminalWindow: NSWindow {
|
|||
}
|
||||
|
||||
private func tabBarDidDisappear() {
|
||||
guard tabBarDidAppearRan else { return }
|
||||
tabBarDidAppearRan = false
|
||||
|
||||
addTitlebarAccessoryViewController(resetZoomAccessory)
|
||||
if styleMask.contains(.titled) {
|
||||
if titlebarAccessoryViewControllers.firstIndex(of: resetZoomAccessory) == nil {
|
||||
addTitlebarAccessoryViewController(resetZoomAccessory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Tab Key Equivalents
|
||||
|
|
@ -449,6 +444,16 @@ extension TerminalWindow {
|
|||
@ObservedObject var viewModel: ViewModel
|
||||
let action: () -> Void
|
||||
|
||||
// The padding from the top that the view appears. This was all just manually
|
||||
// measured based on the OS.
|
||||
var topPadding: CGFloat {
|
||||
if #available(macOS 26.0, *) {
|
||||
return viewModel.hasToolbar ? 10 : 5
|
||||
} else {
|
||||
return viewModel.hasToolbar ? 9 : 4
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if viewModel.isSurfaceZoomed {
|
||||
VStack {
|
||||
|
|
@ -463,7 +468,7 @@ extension TerminalWindow {
|
|||
}
|
||||
// With a toolbar, the window title is taller, so we need more padding
|
||||
// to properly align.
|
||||
.padding(.top, viewModel.hasToolbar ? 10 : 5)
|
||||
.padding(.top, topPadding)
|
||||
// We always need space at the end of the titlebar
|
||||
.padding(.trailing, 10)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,19 +268,15 @@ class NonNativeFullscreen: FullscreenBase, FullscreenStyle {
|
|||
// Removing the "titled" style also derefs all our accessory view controllers
|
||||
// so we need to restore those.
|
||||
for c in savedState.titlebarAccessoryViewControllers {
|
||||
window.addTitlebarAccessoryViewController(c)
|
||||
if window.titlebarAccessoryViewControllers.firstIndex(of: c) == nil {
|
||||
window.addTitlebarAccessoryViewController(c)
|
||||
}
|
||||
}
|
||||
|
||||
// Removing "titled" also clears our toolbar
|
||||
window.toolbar = savedState.toolbar
|
||||
window.toolbarStyle = savedState.toolbarStyle
|
||||
|
||||
// This is a hack that I want to remove from this but for now, we need to
|
||||
// fix up the titlebar tabs here before we do everything below.
|
||||
if let window = window as? TitlebarTabsVenturaTerminalWindow, window.titlebarTabs {
|
||||
window.titlebarTabs = true
|
||||
}
|
||||
|
||||
// If the window was previously in a tab group that isn't empty now,
|
||||
// we re-add it. We have to do this because our process of doing non-native
|
||||
// fullscreen removes the window from the tab group.
|
||||
|
|
|
|||
Loading…
Reference in New Issue