macos: defer key-window focus sync to reduce churn

Amp-Thread-ID: https://ampcode.com/threads/T-019cb9fe-b11b-753f-99e7-8ecc52b73ec4
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Tim Culverhouse
2026-03-04 12:27:48 -06:00
parent 0fa12f8915
commit d1468086ef

View File

@@ -1239,9 +1239,11 @@ class BaseTerminalController: NSWindowController,
}
}
// Becoming/losing key means we have to notify our surface(s) that we have focus
// so things like cursors blink, pty events are sent, etc.
self.syncFocusToSurfaceTree()
// Becoming key can race with responder updates when activating a window.
// Sync on the next runloop so split focus has settled first.
DispatchQueue.main.async {
self.syncFocusToSurfaceTree()
}
}
func windowDidResignKey(_ notification: Notification) {