mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-20 22:35:20 +00:00
macOS: handle surface focus more gracefully
This will fix surface focus state is not consistent with first responder state when the search bar is open
This commit is contained in:
@@ -301,9 +301,8 @@ class BaseTerminalController: NSWindowController,
|
||||
// Our focus state requires that this window is key and our currently
|
||||
// focused surface is the surface in this view.
|
||||
let focused: Bool = (window?.isKeyWindow ?? false) &&
|
||||
!commandPaletteIsShowing &&
|
||||
focusedSurface != nil &&
|
||||
surfaceView == focusedSurface!
|
||||
surfaceView == focusedSurface &&
|
||||
surfaceView.isFirstResponder
|
||||
surfaceView.focusDidChange(focused)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@ extension NSView {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/// Returns true if this view is currently the first responder
|
||||
var isFirstResponder: Bool {
|
||||
window?.firstResponder === self
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Screenshot
|
||||
|
||||
Reference in New Issue
Block a user