Skip to content

Player menus: one shared anchored placer, and the menus anchor to their opener - #1141

Merged
GLinnik21 merged 3 commits into
mainfrom
hud/pr1-anchor-placer
Oct 29, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
hud/pr1-anchor-placer

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

Both player menus (Tracks and More) were placed from classic constants (CTRL_RIGHT - pw, bottom 764) whichever control opened them. Placement now comes from the opener's rect through ONE shared placer.

  • ui/src/popover.rs: anchor_panel(anchor, size, need_h, gap, Placement) -> Anchored { rect, side }. A Placement carries the caller's side order (Fixed list or Facing), cross-axis rule (Leading or Hang, which is hang_x), overflow rule (ClampTop or ClampToRoom) and keep rect.
    • under_or_above is now a call of it (Placement::UNDER_OR_ABOVE) and hang_x is its Hang rule. Neither caller file is edited.
    • The player menus use Placement::PLAYER_MENU: the side facing the screen centre first, then flip, clamp inside SAFE, never over the opener.
    • Popover::rise_offset gives a panel's rise a direction (from the opener's side). Existing callers keep their vertical rise.
  • appkit/src/{track_menu,more_menu}.rs: placement from an anchor rect given by with_anchor and latched for the menu's life. A NEED_H const (600) per menu decides the side, so it does not change between pages.
  • ui/src/theme.rs: PLAYER_MENU_GAP (28) replaces PLAYER_MENU_BOTTOM.
  • screens/src/player/overlay.rs: hands both menus the anchor when it mounts them. Today that is the control row's rect, whose segment edge is CTRL_RIGHT.
  • The overscan audit's menu rects come from the placer.

Why

The HUD-plugin format lets a package put its openers anywhere, so a menu cannot keep classic's fixed corner. This is PR1 of the plan in docs/hud-plugins.md (PR #1139), decision D9: one shared placer, extended in place, no player-local one.

No issue tracks the HUD-plugin work; none was opened for this PR.

Classic does not move

  • More's rise literal 16.0 is now Popover::RISE (20): a 4 px difference in the rise, mid-animation only. Settled frames are unchanged.
  • The one settled frame that differs is a list taller than the old cap. Tracks' cap moves from bottom - 60 (704) to the room above the row (710), and More's from bottom * 0.86 (657) to 710. A Tracks panel with 40 audio dubs is 710 tall instead of 704. No page either menu shows with app-owned rows reaches that height (More's tallest, the Quality page with Auto, is 536).
  • The overscan audit's Tracks rect is now 54..764 (was 60..764) and its More rect is 600 tall (was 320). Both are inside SAFE.

Tests

  • ui: popover_anchor_tests.rs has a test for each side, the flip, the SAFE clamp, the room clamp, the shared segment edge, the latched anchor and the rise direction. It also checks that under_or_above answers the old body's rect over a 5670-case grid. The existing pins (alt_sources_tests.rs, popover_host_tests.rs) are untouched and green.
  • Red first: the placer tests were run against a stub anchor_panel and 7 of 10 failed. The classic pins were captured from the constants-placed panels before the change and passed unchanged after it.
  • appkit: classic_placement_tests pin the settled Tracks panels (audio root, subtitles root, Style page) and More panels (root, Quality page, quality entry) to their old rects. Other tests cover opening beside an anchor on either side, the latch, NEED_H against the measured pages and classic's room, and the overscan rect.
  • screens: every classic opener (Audio disc, Subtitles disc, More disc, failure read-out) hands its menu the control row's anchor.

Gates

Run on the committed tree after merging origin/main (head 0b340e83a; git status --short empty):

make test-crate C=plx_ui
test result: ok. 1428 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 20.20s

make test-crate C='plx_appkit plx_screens'
test result: ok. 485 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 9.58s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1744 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1744 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1744 filtered out; finished in 0.00s
test result: ok. 1745 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 26.11s

make test-crate C=plxnative-modules
test result: ok. 1094 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 26.53s

This lane did not run make check, make check-nodef or the ARM build: this PR's CI is the full gate.

Review

The review verdict was MERGE with four MINOR findings and no BLOCKER or MAJOR. Main had moved (#1139 landed); git merge origin/main was clean.

  1. MINOR, the overlay test cannot tell whether the anchor is handed over: fixed. The menus default to classic's row, the same rect menu_anchor() returns, so deleting a .with_anchor passed. PlayerOverlayScreen::new_anchored(.., anchor) now takes the anchor explicitly (new_with passes menu_anchor()), and every_menu_arm_latches_the_anchor_it_is_handed gives every menu arm an anchor no opener produces. Red first: with .with_anchor dropped from the new_quality arm the new test failed and the old one still passed; restored, it passes. The Force-Direct-Play arm of the quality entry cannot be built in a host test (the session's mode field is private), so that arm is not covered.
  2. MINOR, the "latched anchor" tests do not exercise a latch: partly fixed, partly left. The placer test was named for something it does not pin, so it is now the_same_anchor_and_size_place_the_same_panel_every_time and its doc says what it pins. The latch itself is structural (a private field set once by with_anchor, read nowhere else) and nothing in this PR feeds a live opener rect that a test could change under an open menu, so no honest failing test exists. Once a later PR has live opener geometry, that is where a real latch test belongs.
  3. MINOR, More's NEED_H test measures a shorter page than it claims: the premise is wrong, the prose was wrong too. route::auto_quality_ready() is a const fn returning true (media/src/route/plan.rs), so the shipping ladder already has Auto first and new_quality measures the Auto page. Building the full QUALITY_LADDER with Auto current gave the same 536 px. The "about 600" in the constant's doc was never a measurement. The test now asserts the Auto row is on the page it measures, and the doc says "536 px in English; 600 leaves room for a longer label". The reviewer's scenario (a longer label or an eighth rung) is still what the assertion tallest <= NEED_H guards.
  4. MINOR, More's overscan prose is false: fixed. The audit now asks for the whole screen's height like the track menu's, so both audits take the placer's whole room (710). The prose describes that, and the test pins y == SAFE.y.

Also corrected here: the Classic section's "More's tallest is about 600" now says 536.

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits October 29, 2026 23:52
…ir opener

Both player menus (Tracks and More) were placed from classic constants
(CTRL_RIGHT - pw, bottom 764) whichever control opened them. The HUD-plugin
format lets a package put its openers anywhere, so placement has to come from
the opener's rect through ONE shared placer.

ui/popover.rs gains anchor_panel(anchor, size, need_h, gap, Placement) with a
per-caller Placement (side order, cross-axis rule, overflow rule, keep rect).
under_or_above is now a call of it with its own rules and returns bit-identical
rects (pinned against the old body on a grid, and by the existing
alt_sources/popover pins); hang_x is the Hang cross-axis rule, untouched.
The player menus pass Facing / Hang / ClampToRoom / SAFE: the side facing the
screen centre first, then flip, clamp inside SAFE, never over the opener.
Popover's rise gains a direction (rise_offset); every existing caller keeps
its vertical one.

Tracks and More take an anchor rect at open (with_anchor) and latch it; the
player overlay hands both the control row's rect, whose segment edge is
CTRL_RIGHT, so classic's settled panels do not move. theme gets
PLAYER_MENU_GAP (28) in place of PLAYER_MENU_BOTTOM, and More's literal 16px
rise becomes Popover::RISE. The overscan audit's menu rects come from the
placer.

The one settled frame that changes: a list taller than the old cap. Tracks'
cap moves from bottom-60 (704) to the room above the row (710), More's from
bottom*0.86 (657) to 710; no page either menu shows with app-owned rows is
that tall.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The overlay's anchor test could not tell a screen that hands the anchor to a
menu from one that forgot, because the menus default to the same classic row.
PlayerOverlayScreen::new_anchored takes the anchor explicitly (new_with passes
menu_anchor()), and a test hands every menu arm an anchor no opener produces;
it fails when an arm drops with_anchor.

More's NEED_H test now asserts the Auto row is on the page it measures (the
shipping ladder always has Auto, so that page is the 536 px one) and the
NEED_H doc says so instead of "about 600". More's overscan audit asks for the
whole screen's height like the track menu's, so both audits take the placer's
whole room and the prose describes what is built. The placer's "latched anchor"
test is renamed for what it pins: the placer is pure in its anchor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review October 29, 2026 21:04
@GLinnik21
GLinnik21 merged commit 9986d52 into main Oct 29, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the hud/pr1-anchor-placer branch October 29, 2026 21:14
GLinnik21 added a commit that referenced this pull request Oct 29, 2026
…split

Main's menu anchors name classic's control row; they now read it through
player_hud::classic::frame_geometry().row (measures nothing) and
classic::CTRL_RIGHT / CTRL_Y / CTRL_H, the paths the split gave them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant