Key bindings: pass keys to text fields that are on screen

Character creation and the save window were not detected (the UI manager's
dialog slot held a hidden busy dialog); bound keys were swallowed or posted
their hotkey into the field. A text field now counts while it is the focused
edit control and was drawn in the last 250 ms.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-18 00:57:10 +02:00
1 parent 075f9e2c8a
commit 432cac2ccf
3 files changed
+61 -14

No files matched your search

+17
View File
@@ -62,3 +62,20 @@ Hotkeys found: engine A (pick up nearby), P (pause), Q/W/E/R/B/Space
manager C F H I L M N O S T (S save game window). Arrow keys in
`cEngine::ScrollInput` (`0x610650`) walk object #2 or scroll the camera; not
reachable in normal play.
## Text fields (2026-10-18)
Request: in character creation and the save window, bound keys were ignored or
typed something else (K -> s: K posts the game's S hotkey).
Measured (key-press log): the UI manager's dialog slot (+0x144) held a hidden
`cUI_BusyDlg` in both cases, so the old "dialog shown + focused edit control"
test never found the field. The focused control (+0x148) is the right
`cUI_EditControl`, but neither the focus nor the control's flags (0x8005)
change when its window closes, and the control has no parent at +0x50. The
save window draws two edit controls per frame.
Now (`src/mods/input.cpp`, `FocusedTextField`): keys pass to the game while the
focused control is a writable edit control that `cUI_EditControl::Render`
(0x737ae0, thiscall (renderer), ret 4, returns at once while hidden) drew in
the last 250 ms. The render hook only notes the focused control.