Files
orca/native/computer-use-macos/Sources/OrcaComputerUseMacOSCore/KeyboardInputSafety.swift
T
09872bfe7b Fix macOS keyboard actions targeting the wrong app (#3960)
* fix: guard macos synthetic input focus

* Tighten macOS keyboard focus safety

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
2026-06-03 19:00:34 -04:00

14 lines
454 B
Swift

public enum KeyboardInputSafety {
public enum FocusFailure: Equatable {
case targetNotFocused
case targetNotFocusedAfterRestore
}
public static func syntheticInputFocusFailure(targetWindowFocused: Bool, restoreWindowRequested: Bool) -> FocusFailure? {
guard !targetWindowFocused else {
return nil
}
return restoreWindowRequested ? .targetNotFocusedAfterRestore : .targetNotFocused
}
}