mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-27 07:18:22 +00:00
macOS: fix first responder after dragging a non-focused surface
This fixes a bug: after dragging a non-focused surface from window A to window B **quickly without making B the key window**, the focused surface in window A is not receiving `keyDown` events.
This commit is contained in:
@@ -458,8 +458,12 @@ class BaseTerminalController: NSWindowController,
|
||||
|
||||
replaceSurfaceTree(
|
||||
surfaceTree.removing(node),
|
||||
moveFocusTo: nextFocus,
|
||||
moveFocusFrom: focusedSurface,
|
||||
// When a non-focused surface is removed and this window stays as the key window,
|
||||
// we should refocus the `focusedSurface` to make sure the window's firstResponder remains as it is.
|
||||
//
|
||||
// This is a weird workaround, since `resignFirstResponder` wasn't called on `focusedSurface` after drag,
|
||||
// but the first responder became the window itself.
|
||||
moveFocusTo: nextFocus ?? focusedSurface,
|
||||
undoAction: "Close Terminal"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user