Repository navigation
HUD split: state, model, motion and geometry; HUD travel on FocusEngine groups - #1140
Merged
Merged
Conversation
…rscan rects before the split Records what the classic player HUD does today, as literal tables that must pass unchanged after the player_hud split, the HudNav::focus type change and the move of Up/Down/OK onto FocusEngine groups. No product code changes. The mounted PlayerScreen sits in a real Dispatcher, and every key is delivered as the television delivers one (per-key preamble, key-down, an empty frame for the Tick-time repair, key-up, settle frames), so a press the engine arms and commits is graded the same as one the screen answers itself. Each pin is a key string and the state after its last key: focus region, row button, tab, visible/raised/dismissed flags and the PlayerReqs raised. The tables cover hidden, scrub, every enabled row item and the tab row for plain discs (with and without chapters), an episode, a first and a last episode, Skip Intro, Skip Credits and Up Next, with the named multi-key walks and the row and tab ends. The geometry census pins every groups() entry (id, length, extent), group_of() and place() for 22 probed elements per occupant, a failed read-out, and the overscan audit's rects, undrawn. Not pinned: edge rules, group kinds and seat() (the mechanism being replaced), the engine's own focus key, the transport timer's exact value, scrub travel and OK with a playhead (they need a process-global duration), the repair alert's group, and any drawn pixel. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comments, doc comments, Markdown, the two ci/list-caps.ini section keys and one hook-test fixture path now name the files the player HUD split into (state, model, motion, geometry, classic, with the captions, the subtitle bitmaps and overscan_rects staying in mod.rs). No code token changes. Dated records (audits, reviews, decision records, measurement logs, the parity table) keep the old path as evidence of the tree they describe. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, HudGeometry, HudMotion
player_hud.rs (3600 lines) becomes a directory. No behaviour change: the
appkit suite is the same 351 tests plus two that pin the new geometry.
state.rs the HUD's logic, no pixels (slot, Busy, FailureReadout, scrub
tuning); re-exported from mod.rs so those paths do not move
model.rs HudModel: a Copy per-frame snapshot of every global the draw
path read (TX.paused, scrub_ns, playpos_ns, seek_display_ns,
duration_ns, loading, the caption picks and the bitmap cue)
motion.rs ClockWarm, RowPop, HudMotion (TransportRow, renamed)
geometry.rs GROUP_SCRUB/ROW/TABS/FAILURE, HudGeometry, RowAnchor
classic.rs the classic layout and every draw; frame_geometry() and
geometry() report its rects
tests.rs the old tests module, expectations untouched
Draws take &HudModel and a GroupId; ClockWarm::queue_live(ps) is
queue(&HudModel). up_next reads the RowAnchor instead of CTRL_*.
overscan_rects reads frame_geometry() and reports the same four rects.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ver the files outside appkit) 42 mechanical rewrites in 5 files: player_hud::NAME -> player_hud::<module>::NAME for the items that moved to classic/motion, TransportRow -> HudMotion. Call signatures are not touched; the screen and app adaptations are the next wave. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r's focus after its own nav writes
The app crate is the runner that reads the process globals, so it samples the HUD's
inputs into one HudModel value (run::hud_model) and hands it to the player page in
prepare_window, after the pump and the dispatcher frame and before the clock
fingerprint and the draw. The busy/transport push in draw is unchanged.
hud.nav.focus is a GroupId now. Every app-side write to it (FocusTabs, the headless
pin, the stand-in's departure, the auto-hide park) is followed by
bridge::reseat_player_focus, which delivers Enter::Fresh { ContainerGroup } to the
player page through Dispatcher::emit so the FocusEngine travels from where the
cursor was put. The probe still prints the group's integer.
Tests follow the moved geometry (frame_geometry().grab / scrub_frac, row_anchor.top);
a hostsim test pins that each HudModel field reads the global its draw used to read.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…s a GroupId; Focusable reads HudGeometry No behaviour change. PlayerScreen's Up/Down travel and OK now ride the shared FocusEngine instead of a hand-written ring: - HudNav.focus is a GroupId (HOME = GROUP_SCRUB), the HUD's four group ids come from appkit::player_hud::geometry, and nav is the mirror of engine focus. - Screen::links declares scrubber Up -> row, scrubber Down -> tabs, row Down -> scrubber, tabs Up -> scrubber; the row's Up and the tabs' every side are EdgeRule::Screen, answered by answer_edge (UP off the row hides the HUD, DOWN off the tabs re-arms the linger). key_updown and its ring arithmetic are gone. - A directional FocusMoved that changes group carries the travel's side effects (drop the scrub target when leaving the scrubber, re-arm the linger); a re-seat only mirrors nav. Clicks seat the engine on the element they press. - key_ok: a pending target first, then the element the engine holds decides (row -> ArmControlRow, tab -> Info / Chapters, else play/pause). - Focusable::groups/place/record_stops and pointed_ns read HudGeometry (scrub_hit_rect/ctrl_row_hit_rect are no longer named in screens); draw and prepare read the new PlayerScreen.model: HudModel. - Tests drive Up/Down/OK through a small rig that replays the dispatcher's after-step order against a real FocusEngine and the screen's own links. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…transport prose names the HudModel PlayerScreen::raise_for_offer writes hud.nav with no effect to carry, so the app that calls it (app/run.rs, once per segment) must hand the engine a fresh seat on the ring's group afterwards. Without it the engine stayed on the scrubber and OK on a Skip offer toggled play/pause instead of arming the pill. Adds a screens test that pins the pairing (the engine does not follow by itself; the re-seat puts OK on the row's primary button), and rewords three comments that said the HUD reads the Transport atomics directly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge: main's #1007 (Arabic and Hebrew titles) edited appkit/src/player_hud.rs, which this PR deletes. The file stays deleted; its change is ported into player_hud/classic.rs (the paused title's right-to-left reveal) and its test, a_paused_right_to_left_title_reveals_its_end_to_the_left, into player_hud/tests.rs. Review fixes: - the clock prewarm reads the page's own scrub, not the app's snapshot from the previous frame, so a fast scrub warms the clocks the draw will show (test red first) - a test pins that pin_headless_hud's ring write is paired with an engine re-seat (red with the re-seat removed) - the HudModel sampling test now sets loading and the three caption picks to values of their own - classic::scrub_frac_x (dead, duplicated HudGeometry::scrub_frac) is removed; scrub_hit_rect and ctrl_row_hit_rect are module-private - comments that named the deleted key_updown follow the code Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rst remaining disc, as main does The stand-in's departure wrote nav = HOME and re-seated the engine on the scrubber. On main the engine stays on the stand-in's item and its own reconcile moves it to the row's primary disc, which the page mirrors into nav: the ring lands on the first remaining disc and the next OK opens its menu. Re-seating on the scrubber left no disc focused and the next OK paused the film (the simulator's before/after pairs, 3 of 3). The segment-offer / stand-in-departure block of update is now follow_control_row(app, ctrl, now) so a hostsim test can offer a stand-in and retire it. The test fails on the previous commit (mirror (GroupId(0), 0), want (GroupId(1), 2)) and passes with the re-seat removed, for Skip and for Up Next. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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]>
…bber, for the engine too standin_left_the_ring's contract is that a stand-in vanishing from under the ring sends it to the scrubber, so the next OK toggles play. key_ok acts on the element the engine holds, so the departure has to seat the engine there as well: without it an enabled Previous / Restart on an episode kept the engine, and OK restarted the episode. On a movie this is a deliberate change from main, where a pressed Skip left the engine on item 0, reconcile moved it to Subtitles and mirrored that into nav, and OK opened the Subtitles menu. Replaces the previous commit's test with two through the real dispatcher: a Skip retiring on a movie, and an Up Next stand-in leaving an episode whose first disc is enabled. Both fail without the re-seat (nav GroupId(1) / engine element 11) and pass with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR2 of the player-HUD plugin plan (
docs/hud-plugins.md). It splits the player HUD into state, model, motion and geometry, and moves HUD travel and OK onto FocusEngine groups. It is meant to change no behaviour. This is the contract the plugin renderer (PR7) draws through:HudModelin,HudGeometryout.What changes
appkit/src/player_hud.rsis nowplayer_hud/:state.rs: the app-owned state logic, such asslot_for,busyand the scrub ladder.model.rs:HudModel, the per-frame read-only snapshot of every value the draw path used to read from process globals. It holdsCopyfields and borrowed strings, so building it allocates nothing.motion.rs:HudMotion, with the springs,CtlPopand the reveals.geometry.rs:HudGeometry, what the layout reports back.classic.rs: the classic constants and layout.tests.rs.seek_jump.rsstays where it was.HudModelonce a frame inrun.rsand pushes it into the player screen. No draw function underplayer_hud/reads a global.HudMotion::stepstill reads the transport, because it runs from the screen's tick; feeding it a frame-old model value would move its timing.Focusable, the pointer stops,overscan_rectsand the Up Next/Skip stand-ins readHudGeometry, not classic constants.nav.focusis a FocusEngineGroupId. The hand-walked ring inkey_updownis gone: Up from the top group hides the HUD as the screen's answer toStep::Edge. After each of the app's own writes tonav, it re-seats the player's engine, including after a fresh Skip offer raises the row. Without that, OK on a Skip offer would have toggled play/pause.pr2-import-move.py); theci/list-caps.inirows were re-keyed to the new files, and the docs were updated. Dated records underdocs/keep the old name.How "no behaviour change" is checked
The first commit (
0323e89d9) addsscreens/src/player/hud_pins_tests.rs. It pins classic's Up/Down/Left/Right/OK from every HUD focus (scrub, the control row, Up Next, Skip), the hit census, and the rectsHudGeometryreports, using the pre-split code. The file has no diff after that commit, and the pins pass on the final tree.Issue
No issue tracks the HUD-plugin work, and none was opened for this PR.
Gates
Local, on
d1cd69ea3, crate tests only (the full gate is this PR's CI):make test-crate C='plx_appkit plx_screens':test result: ok. 353 passed; 0 failed(plx_appkit) andtest result: ok. 1737 passed; 0 failed(plx_screens).make test-crate C=plxnative-modules:test result: ok. 1094 passed; 0 failed.make test-hostsim:test result: ok. 1214 passed; 0 failed.Still owed: a simulator pass on two timings. First, Up off the control row must hide the HUD on the first press while the film keeps playing. Second, OK after a Skip offer must press the pill.
🤖 Generated with Claude Code
Review
Head
5515555cc. Required checks, re-run on the committed tree (git status --shortempty):make test-crate C='plx_appkit plx_screens':test result: ok. 475 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 9.42s(plx_appkit), then threetest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1755 filtered out; finished in 0.00slines, thentest result: ok. 1756 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 26.24s(plx_screens)make test-crate C=plxnative-modules:test result: ok. 1094 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 26.67smake test-hostsim:test result: ok. 1215 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 33.29sci/check-deps.sh,ci/check-list-caps.py,ci/check-module-layers.py,ci/check-ledger-ratchet.py.Findings:
main(UI text: Arabic and Hebrew with RTL paragraphs #1007 edits the deletedplayer_hud.rs): fixed. Mergedorigin/main(2623e4560). The file stays deleted. UI text: Arabic and Hebrew with RTL paragraphs #1007's change is ported intoplayer_hud/classic.rs::draw_player_title(reveal_once_at(.., rtl)), and its testa_paused_right_to_left_title_reveals_its_end_to_the_leftintoplayer_hud/tests.rs(HudMotion::new()). Red first: with the oldSB_X - offsetline the test fails (left: 56.0 right: -1958.24); with the port it passes.mergeableis nowMERGEABLE.PlayerScreen::preparenow setsmodel.scrub_nsfrom the page's own published scrub (published_scrub(), also whatpublishwrites) beforeClockWarm::queue; the page'sTickhas already advanced it. New testprepare_warms_the_clocks_for_the_scrub_the_draw_will_show_not_last_frames: red first (left: Some((10, 7190)) right: Some((600, 6600))), green after. The rest of the model stays a frame old inprepare; at 1x playback the prewarm already covers the displayed second and the next, so only the scrub needed the fresher value.key_okno longer doesnav.focusarithmetic; it reads the element the engine holds (row_index(focused),hud_group_of(focused)). What AC4 named, thefocus 0/1/2ring inkey_updown, is gone.Activate/press machinery because the transport's stops areActivate::Directon purpose (see the comment aboverecord_stops): the row's dip-then-act is the loop's (ArmControlRow→press.begin_ctl→activate_player_rowon the spring-back), and the scrubber's meaning needs the click'sx. Moving it ontoActivate::Pressis control identity and commands, which this PR's brief puts in PR3.app/input.rs::key_okis dead for the player page:owns_input()is true for anEnginepage, sotree_owns_keytakes OK first (the neighbouring comment inrun.rsalready says this about the old UP/DOWN arm). It was dead before this PR, which only changed its literals toGROUP_ROW/GROUP_TABS. Deleting it is a separate cleanup I could not verify without the device. The earlier handoff's AC4 entry should have said all of this.pinning_the_headless_hud_on_a_tab_seats_the_engine_there_toodrivespin_headless_hudandreseat_player_focusthrough a mounted player and asserts the engine is on the tab. Red first: with the re-seat removed it fails (the engine left the scrubber,left: Some(0) right: Some(0)). Still uncovered: the fresh-offerreseat = true, the stand-in departure, the auto-hide park, andPlayerReq::FocusTabs. They sit insideupdateor the request handler, and reaching them needs a marker offer or a panel on the rig, which it has no cheap way to build. They need the TV or simulator pass already listed.the_hud_model_samples_each_global_the_draw_used_to_readdid not setloadingand the three caption picks: fixed. It now sets Buffering, Large, High and Charcoal and reads each back (restoring the globals before grading).classic::scrub_frac_xand over-widepubs: fixed. Removedscrub_frac_x(its duplicate arithmetic lives inHudGeometry::scrub_frac), fixed the comment that named it, and madescrub_hit_rectandctrl_row_hit_rectpub(super)(their only callers areclassicand its tests).key_updown: fixed inapp/run.rsandapp/playback.rs.Not changed, for the record:
HudMotion::step/note_transportstill readTXat Tick time (disclosed in the body above; moving them onto the model would shift the springs by a frame).Review, round 2 (simulator finding 2b extra)
Head
ef1887a39. Required checks, re-run on the committed tree (git status --shortempty):make test-crate C='plx_appkit plx_screens':test result: ok. 487 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 10.00s(plx_appkit), then threetest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; ... 1757 filtered out; finished in 0.00slines, thentest result: ok. 1758 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 27.33s(plx_screens)make test-crate C=plxnative-modules:test result: ok. 1094 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 27.15smake test-hostsim:test result: ok. 1216 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 33.36sci/check-deps.sh,ci/check-list-caps.py,ci/check-module-layers.py,ci/check-ledger-ratchet.py.BLOCKER: after the Skip pill retires, no disc is focused and the next OK pauses (main: Subtitles opens). Fixed.
main's player screen, not guessed. Onmain, when the stand-in leaves, the app writesnav = HOMEbut does not touch the engine. The engine still sits on the stand-in's item (the row's item 0), which a movie's discs do not have. Its ownreconcilemoves it to the row's primary disc, and theFocusMovedhandler mirrors that back intonav(row, Subtitles). So the ring lands on the first remaining disc. On this branch the departure also calledreseat_player_focus, which seated the engine on the scrubber, so reconcile never ran, and OK toggled play/pause. That re-seat was the round-1 "pair every app-sidenavwrite" rule applied one site too many.reseat_player_focusdoc say why. The segment-offer and stand-in block ofupdateis nowfollow_control_row(app, ctrl, now), so a test can offer a stand-in and retire it (no change to what it does).a_skip_pill_that_retires_leaves_focus_on_the_first_remaining_disc(hostsim, app crate, mounted player). It offers the stand-in, asserts the engine holds its item, retires it, then asserts the mirror, the engine, andControls::NONE.action(primary) == Some(Action::Subtitles)(so OK opens Tracks tab 1). It covers Skip and Up Next. On the previous commit it fails:the mirror,left: (GroupId(0), 0) right: (GroupId(1), 2). It passes with the re-seat removed. The rig is the app crate's real dispatcher with a mountedPlayerScreenand the stand-in slot injected throughfollow_control_row; it does not build a marker in the metadata store.PlayerReq::FocusTabs: the same asmainin effect.mainsetnav.focus = 2with the engine already on the tab that opened the panel; this branch also re-seats onGROUP_TABS, whose seat is the tab innav.tab, i.e. the same tab. No test added (it needs a panel on the rig); the headless-pin test from round 1 covers the same helper.mainon purpose, not changed.mainwrotenav = HOMEand left the engine on whatever it held, so after a re-reveal the ring showed on the scrubber while the engine was still on the row or a tab (UP could then hide the HUD again from a "row" nobody saw). This branch seats the engine on the scrubber with it. Ring and the OK action are the same asmain; only a direction key after the reveal differs, and it now does what the ring shows. This is read from the code, not measured, and not pinned by a test (the park sits inline inupdatebehind the countdown logic). If the owner wants strict parity it is deleting onereseat_player_focuscall inupdate.navsays scrubber, onmainand here alike (reconcile only fires for a disabled item). Same behaviour on both; left alone.Merge:
mainmoved again (9986d528c, #1141, menus anchor to their opener). Merged; two conflicts inappkit/src/{track_menu,more_menu}.rs, taken frommainwith its tests kept. #1141's anchors name classic's control row, which the split moved: they now readplayer_hud::classic::frame_geometry().row(measures nothing) andclassic::CTRL_RIGHT/CTRL_Y/CTRL_H, intrack_menu,more_menu,screens/player/overlay.rsandoverlay_tests.rs. The PR isMERGEABLE.Deliberate behaviour change: a stand-in leaving the row sends the ring to the scrubber
This is the one place the PR does not match
main, by decision.standin_left_the_ring's doc comment,appkit/src/player_hud/state.rs): "has a stand-in just vanished OUT FROM UNDER the focus ring, so the ring has to go back to the scrubber? … It exists because the row swapping from a Skip pill back to the discs leaves focus on the row withbtnstill 0, so the next OK opens the SUBTITLES menu instead of toggling pause."maindoes: it writesnav = HOMEand acts onnav, but leaves the engine seated on the stand-in's item. Simulator before/after pairs (3 of 3, Sintel, a movie): after a pressed Skip,mainhas Subtitles focused and the next OK opens the Subtitles menu (coldopen screen=menu). The cause is the engine's reconcile moving the stale item-0 seat to Subtitles and mirroring it intonav; that is exactly the bug the comment says the edge exists to kill. For an Up Next stand-in on an episode, whose first disc is enabled, reconcile does not fire andmaindoes follow the contract (toggle pause).follow_control_row→reseat_player_focus), sonav, the engine and the ring agree after any departure (pill pressed, seek out of the marker, marker end) and the next OK toggles play. In this PRkey_okacts on the engine's element, so without the re-seat the episode case would press Restart (found in the simulator, round 2 of the check).mainbug. Only the movie-Skip result differs frommain(OK now pauses, where it opened Subtitles).a_skip_pill_that_retires_on_a_movie_sends_the_ring_to_the_scrubberandan_up_next_stand_in_that_leaves_an_episode_sends_the_ring_to_the_scrubber(hostsim, app crate, real dispatcher: offer the stand-in, retire it, assertnavand the engine on the scrubber, press OK, assert the request isTransport(None)). Both fail without the re-seat (movie:navGroupId(1); episode: engine element 11) and pass with it.Review, round 3
Head
06f0e4cfb. This supersedes round 2's departure fix (which removed the re-seat to matchmain's movie behaviour; its test is replaced). Mergedorigin/main(4d27dec82, #1142/#1143), no conflict.ef1887a39's behaviour: movienavGroupId(1)vsGroupId(0); episode engineSome(11)vsSome(0).reseat_player_focusdoc and the departure comment now say the departure re-seats and why.Required checks, re-run on the committed tree (
git status --shortempty):make test-crate C='plx_appkit plx_screens':test result: ok. 545 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 10.37s(plx_appkit), then threetest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1757 filtered out; finished in 0.00slines, thentest result: ok. 1758 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 29.97s(plx_screens)make test-crate C=plxnative-modules:test result: ok. 1094 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 29.61smake test-hostsim:test result: ok. 1217 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 34.70sci/check-deps.sh,ci/check-list-caps.py,ci/check-module-layers.py,ci/check-ledger-ratchet.py.