runtime: the first-run UI keyboard pad reads keys only with focus (RT-FIRST-RUN-PAD-FOCUS) #1612

Merged
Tyrannys merged 2 commits from upstream-pr/1612 into main 2026-11-25 19:30:08 +00:00
Tyrannys commented 2026-11-25 05:54:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-25T05:54:52Z.


Claimed in the coordination issue as: RT-FIRST-RUN-PAD-FOCUS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154210350)

What and why

gta6rt --first-run-ui set LEONIDA_KEYBOARD_PAD=always as part of its profile (configure_first_run_ui in runtime/src/main.cpp). In that mode the keyboard pad reads the physical keyboard whatever has focus, so keys typed into another program reach the title. On a first-run consent page an Enter could tick a box in the user's name. This is hazard 1 of #1552.

The profile now uses the focused mode 1. Keys count only while the title window has focus. Scripted presses (LEONIDA_INPUT_SCRIPT) still run while the window is unfocused (runtime/shims/gameinput.cpp, the active gate in the pad poll). If the caller sets LEONIDA_KEYBOARD_PAD explicitly, that setting still wins.

  • runtime/src/main.cpp: change the default from always to 1.
  • runtime/test/fixtures/tiny_game.cpp: the first-run branch checks that LEONIDA_KEYBOARD_PAD is 1.
  • runtime/CMakeLists.txt: run_tiny_first_run_ui clears LEONIDA_KEYBOARD_PAD, so the caller's shell can't mask the default.
  • docs/first_run_ui.md: says the pad is in its focused mode.

Out of scope: the boot.ps1 side (#1609, RT-KEYBOARD-PAD-SCRIPT) and the shim's own default (#1528). This PR doesn't touch either.

Tested

Windows 11, RTX 4070 SUPER (NVIDIA 621.01), MSVC. No game files.

  • ctest -R "run_tiny_first_run_ui|run_tiny_game$": 2/2 pass.
  • Negative check: with LEONIDA_KEYBOARD_PAD=always set by the caller, tiny_game prints FAIL first-run UI keyboard pad reads keys only with focus. So the check catches the old default.
  • scripts/check_no_game_data.py on the changed files: clean.

AI-assisted (Claude Code).

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5486010810 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1612). Originally posted by [Tyrannys](https://github.com/Tyrannys) on 2026-11-25T05:54:52Z. --- Claimed in the coordination issue as: RT-FIRST-RUN-PAD-FOCUS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154210350) ### What and why `gta6rt --first-run-ui` set `LEONIDA_KEYBOARD_PAD=always` as part of its profile (`configure_first_run_ui` in `runtime/src/main.cpp`). In that mode the keyboard pad reads the physical keyboard whatever has focus, so keys typed into another program reach the title. On a first-run consent page an Enter could tick a box in the user's name. This is hazard 1 of #1552. The profile now uses the focused mode `1`. Keys count only while the title window has focus. Scripted presses (`LEONIDA_INPUT_SCRIPT`) still run while the window is unfocused (`runtime/shims/gameinput.cpp`, the `active` gate in the pad poll). If the caller sets `LEONIDA_KEYBOARD_PAD` explicitly, that setting still wins. - `runtime/src/main.cpp`: change the default from `always` to `1`. - `runtime/test/fixtures/tiny_game.cpp`: the first-run branch checks that `LEONIDA_KEYBOARD_PAD` is `1`. - `runtime/CMakeLists.txt`: `run_tiny_first_run_ui` clears `LEONIDA_KEYBOARD_PAD`, so the caller's shell can't mask the default. - `docs/first_run_ui.md`: says the pad is in its focused mode. Out of scope: the `boot.ps1` side (#1609, RT-KEYBOARD-PAD-SCRIPT) and the shim's own default (#1528). This PR doesn't touch either. ### Tested Windows 11, RTX 4070 SUPER (NVIDIA 621.01), MSVC. No game files. - `ctest -R "run_tiny_first_run_ui|run_tiny_game$"`: 2/2 pass. - Negative check: with `LEONIDA_KEYBOARD_PAD=always` set by the caller, tiny_game prints `FAIL first-run UI keyboard pad reads keys only with focus`. So the check catches the old default. - `scripts/check_no_game_data.py` on the changed files: clean. AI-assisted (Claude Code). GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
JoeY54 commented 2026-11-25 06:27:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by JoeY54 on 2026-11-25T06:27:51Z.


Independent Windows validation at 7f08453da77d282924c09b6dc2ac51d69a369547.

CTest passed 4/4 across run_tiny_first_run_ui, run_tiny_game, gameinput, and gameinput_script. The input tests reported 364 and 10 checks respectively, all passing.

  • tiny_game confirmed that the first-run profile defaults to focused keyboard input and preserves the tested caller override.
  • With simulated keys and window focus, the GameInput suite verified that unfocused key presses are ignored, held inputs release on focus loss, and scripted input survives focus loss. Live Alt-Tab and physical keyboard behavior remain unverified.
  • The negative control explicitly set LEONIDA_KEYBOARD_PAD=always. The fixture reported the expected keyboard focus check failure and exited 1.

Windows 11 Pro 26H2 (26300.9974), MSVC 19.52.37029.0, and repository-pinned SDL 3.4.20. Used the synthetic tiny_game fixture and SDL virtual input. AI-assisted with Codex. Test coordination.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7154816381 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1612#issuecomment-7154816381). Originally posted by [JoeY54](https://github.com/JoeY54) on 2026-11-25T06:27:51Z. --- **Independent Windows validation** at `7f08453da77d282924c09b6dc2ac51d69a369547`. CTest passed **4/4** across `run_tiny_first_run_ui`, `run_tiny_game`, `gameinput`, and `gameinput_script`. The input tests reported 364 and 10 checks respectively, all passing. - `tiny_game` confirmed that the first-run profile defaults to focused keyboard input and preserves the tested caller override. - With simulated keys and window focus, the GameInput suite verified that unfocused key presses are ignored, held inputs release on focus loss, and scripted input survives focus loss. Live Alt-Tab and physical keyboard behavior remain unverified. - The negative control explicitly set `LEONIDA_KEYBOARD_PAD=always`. The fixture reported the expected keyboard focus check failure and exited 1. Windows 11 Pro 26H2 (26300.9974), MSVC 19.52.37029.0, and repository-pinned SDL 3.4.20. Used the synthetic `tiny_game` fixture and SDL virtual input. AI-assisted with Codex. [Test coordination](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154458408).
Tyrannys commented 2026-11-25 14:00:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-25T14:00:02Z.


Brought up to date with main at 384abe5b0 by a merge (03096929f); no force-push. Conflicts were in runtime/src/main.cpp and docs/first_run_ui.md: main's first-run profile no longer sets LEONIDA_GPU_LABELS, and that is kept; this PR's focused keyboard pad (LEONIDA_KEYBOARD_PAD=1) replaces main's always.

Tested on Windows 11 (RelWithDebInfo), runtime tests only, no game boot:

  • run_tiny_first_run_ui: passes
  • full ctest: 428 passed, 11 skipped and 2 disabled (game package or tools not installed here), 1 failed. The failure is xs_proxy_mock at its tear check (g_tear.reads > 0): that check is main's and untouched here; its reader thread got no reads while the machine was fully loaded by a long pipeline-cache build. Unrelated to this change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7164602398 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1612#issuecomment-7164602398). Originally posted by [Tyrannys](https://github.com/Tyrannys) on 2026-11-25T14:00:02Z. --- Brought up to date with `main` at 384abe5b0 by a merge (03096929f); no force-push. Conflicts were in `runtime/src/main.cpp` and `docs/first_run_ui.md`: main's first-run profile no longer sets `LEONIDA_GPU_LABELS`, and that is kept; this PR's focused keyboard pad (`LEONIDA_KEYBOARD_PAD=1`) replaces main's `always`. Tested on Windows 11 (RelWithDebInfo), runtime tests only, no game boot: - `run_tiny_first_run_ui`: passes - full `ctest`: 428 passed, 11 skipped and 2 disabled (game package or tools not installed here), 1 failed. The failure is `xs_proxy_mock` at its tear check (`g_tear.reads > 0`): that check is main's and untouched here; its reader thread got no reads while the machine was fully loaded by a long pipeline-cache build. Unrelated to this change. AI-assisted (Claude Code).
aslan2142 commented 2026-11-25 19:30:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T19:30:11Z.


Merged, thanks! Tested 03096929f merged onto main with the full Windows suite under Wine (llvmpipe and a RADV iGPU). The suite matches main, apart from the known timing flake in xmem (the "reader of the views' last pages" check), which this PR doesn't touch.

  • Checked on main cee965560 + 03096929f: it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 4 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7172385887 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1612#issuecomment-7172385887). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T19:30:11Z. --- Merged, thanks! Tested `03096929f` merged onto `main` with the full Windows suite under Wine (llvmpipe and a RADV iGPU). The suite matches `main`, apart from the known timing flake in `xmem` (the "reader of the views' last pages" check), which this PR doesn't touch. - **Checked on `main` `cee965560` + `03096929f`:** it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 4 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1612
No description provided.