fix(v2): pcControl keys to a minimised window bring back the window that was in front

restore activates the window (SW_RESTORE), so restoring before keys made the
window already in front: the window that was in front before was not brought
back, and the game / full-screen check came after the window had moved. Keys
now note the window in front and check for a game first, then restore inside
the moment in front. A minimised window never takes keys behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-19 11:08:30 +09:00
parent 9a296a5683
commit 20bd90f65e
3 changed files with 60 additions and 9 deletions

View File

@@ -254,7 +254,9 @@ agent-desktop and decides who may.
has none; win-ci VM 2026-11-19), so keys go behind only where there is no doubt where they land.
Store and WinUI apps (the new Calculator), Chromium, Electron and Firefox windows have none.
- **In front for a moment**: a combination, any other key, and every key for a window that does
not take keys behind. The window is brought to the front (`focus-window`, then `press`) and the
not take keys behind or is minimised. A minimised window is restored inside the moment
(restoring brings it forward, so the window in front is noted before and brought back after;
the window itself stays restored). The window is brought to the front (`focus-window`, then `press`) and the
window that was in front before is brought back right after (`focus-window` on it, also when
`press` failed; one that cannot be brought back is left, with a warning in the log). For a
window whose process agent-desktop cannot find from the window (the new Calculator, a Store
@@ -315,7 +317,8 @@ agent-desktop and decides who may.
interactive elements read afresh after the action (at most 200), so the brain says it was done
only from what it sees; an action that closes its window (a dialog's button, Enter) answers the
window with no elements. agent-desktop's error codes come back as Korean reasons (`STALE_REF`: "화면이
바뀌었습니다. 다시 읽어 주세요"; a minimised window is restored before acting).
바뀌었습니다. 다시 읽어 주세요"; a minimised window is restored before acting; for `keys` inside
the moment in front, "Keys").
- **Refused before asking**: the stop, the anti-cheat, an administrator window (a process whose
elevation cannot be read counts as one) and a password field are refused without asking.
`windows` and `read` at `ask` answer `ask: true` like the rest.