Merge pull request #1276 from mitchellh/mrn/fix-cascade-glitch

macos: stop windows glitching when cascading
This commit is contained in:
Mitchell Hashimoto
2024-01-10 09:37:49 -08:00
committed by GitHub

View File

@ -78,14 +78,16 @@ class TerminalManager {
window.toggleFullScreen(nil) window.toggleFullScreen(nil)
} }
c.showWindow(self) // We're dispatching this async because otherwise the lastCascadePoint doesn't
// take effect. Our best theory is there is some next-event-loop-tick logic
// Only cascade if we aren't fullscreen. This has to be dispatched async // that Cocoa is doing that we need to be after.
// because it takes one event loop tick for showWindow to work. DispatchQueue.main.async {
if (!window.styleMask.contains(.fullScreen)) { // Only cascade if we aren't fullscreen.
DispatchQueue.main.async { if (!window.styleMask.contains(.fullScreen)) {
Self.lastCascadePoint = window.cascadeTopLeft(from: Self.lastCascadePoint) Self.lastCascadePoint = window.cascadeTopLeft(from: Self.lastCascadePoint)
} }
c.showWindow(self)
} }
} }