fix(ui): a click on the Insert menu's page no longer leaves the page drawn over the game after the menu closes #3058

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/menu-stays into main 2026-12-03 07:50:11 +00:00
Owner

Summary

After a mouse click on the Insert menu's page, closing the menu could leave a picture of the page (its tabs and rows,
no card, no hint bar, a stray "..." at its top left) drawn over the game. Reopening and closing the menu did not clear it.

Cause: a left press on the hosted page went through Core::left_press's window branch. That branch raises a window on
the z order and pushed the hosted page there too. Nothing took the page out again. With the menu closed, shown_order
still listed the page from z, so it was laid out unhosted: no banner, so its top Tabs and banner action were painted
in the page. It was then pushed as a SCREEN root, which ui_draw draws whatever the menu's state. The
vk: UI: a hosted root ... not drawn guard only looks at HOSTED roots, so it never fired.

Fix (game/crates/ui/src/core.rs): a click raises only real windows, not the hosted page, and shown_order takes only
mounted Window roots from the z order.

Read first: Core::left_press, Core::shown_order.

Testing

Tested: game-free only. game-ui's new test the_hosted_page_clicked_is_gone_from_the_frame_when_the_menu_closes
fails on main ("the page is not shown with the menu closed") and passes here. All 159 game-ui tests pass, and
clippy -D warnings and rustfmt are clean. Not yet run in the game.

Still to test:

  • Linux, any GPU: open the menu with F1, click a row on the Graphics page with the mouse, close with F1. Expect nothing
    of the menu left on screen. (by hand)
  • Any PC: a mod window still raises and takes the focus on a click. (by hand)

Measurements

Nothing to measure: a fix to which UI roots are shown, with no cost per frame.

Risks

A root kept on the z order whose mount is no longer a window is no longer shown from it. That is intended: only windows
belong there. A revert is enough. Players notice nothing after updating except that the stuck menu picture is gone.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (not yet run in the game)
  • mise run test passes (any failure that also fails on main is named). (only game-ui's tests run so far)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ

## Summary After a mouse click on the Insert menu's page, closing the menu could leave a picture of the page (its tabs and rows, no card, no hint bar, a stray "..." at its top left) drawn over the game. Reopening and closing the menu did not clear it. Cause: a left press on the hosted page went through `Core::left_press`'s window branch. That branch raises a window on the z order and pushed the hosted page there too. Nothing took the page out again. With the menu closed, `shown_order` still listed the page from `z`, so it was laid out unhosted: no banner, so its top Tabs and banner action were painted in the page. It was then pushed as a `SCREEN` root, which `ui_draw` draws whatever the menu's state. The `vk: UI: a hosted root ... not drawn` guard only looks at `HOSTED` roots, so it never fired. Fix (`game/crates/ui/src/core.rs`): a click raises only real windows, not the hosted page, and `shown_order` takes only mounted `Window` roots from the z order. Read first: `Core::left_press`, `Core::shown_order`. ## Testing **Tested:** game-free only. `game-ui`'s new test `the_hosted_page_clicked_is_gone_from_the_frame_when_the_menu_closes` fails on `main` ("the page is not shown with the menu closed") and passes here. All 159 `game-ui` tests pass, and clippy `-D warnings` and rustfmt are clean. Not yet run in the game. **Still to test:** - Linux, any GPU: open the menu with F1, click a row on the Graphics page with the mouse, close with F1. Expect nothing of the menu left on screen. (by hand) - Any PC: a mod window still raises and takes the focus on a click. (by hand) ## Measurements Nothing to measure: a fix to which UI roots are shown, with no cost per frame. ## Risks A root kept on the z order whose mount is no longer a window is no longer shown from it. That is intended: only windows belong there. A revert is enough. Players notice nothing after updating except that the stuck menu picture is gone. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (not yet run in the game) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (only `game-ui`'s tests run so far) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ
fix(ui): a click on the Insert menu's page no longer leaves the page drawn over the game after the menu closes
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Failing after 6s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 14s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m12s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 11m16s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m39s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m12s
CI / Website build and checks (pull_request) Failing after 41s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 51m36s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m4s
5c4859dfc6
A click on the hosted page raised it among the windows (left_press pushed it on the z order) and nothing took it out:
with the menu closed shown_order still listed it, laid out unhosted (its tabs inline, its banner's "..." at its top)
and drawn as a screen root, which the renderer draws whatever the menu's state. Only windows are raised now, and only
a mounted window is shown from the z order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ
HumanBean changed title from WIP: fix(ui): a click on the Insert menu's page no longer leaves the page drawn over the game after the menu closes to fix(ui): a click on the Insert menu's page no longer leaves the page drawn over the game after the menu closes 2026-12-03 07:50:06 +00:00
HumanBean deleted branch fix/menu-stays 2026-12-03 07:50:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
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.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3058
No description provided.