Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Sources/UntoldEngine/Systems/InputSystem+Keyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,17 @@ public extension InputSystem {
// real keyboard focus (click, cursor appears) without reliably posting it, so
// this falls back to asking the key window directly what's actually focused
// right now, rather than trusting a notification that may never have fired.
if let responder = NSApp.keyWindow?.firstResponder, responder is NSText {
// This method is only ever called from an NSEvent local monitor handler, which
// AppKit always invokes on the main thread, so the isolation is actually held —
// assumeIsolated just proves that to the compiler instead of marking this whole
// (nonisolated-callable) type @MainActor.
let hasTextResponder = MainActor.assumeIsolated {
if let responder = NSApp.keyWindow?.firstResponder, responder is NSText {
return true
}
return false
}
if hasTextResponder {
return false
}
return true
Expand Down
Loading