Skip to content

Pointer and wheel reach the loop as a HostEvent, and the cursor hide is the platform's - #1492

Merged
GLinnik21 merged 7 commits into
mainfrom
platform/w5c-pointer-wheel
Nov 20, 2026
Merged

GLinnik21 merged 7 commits into
mainfrom
platform/w5c-pointer-wheel

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Step W5c of the platform plan (discussion #1460). Pointer and wheel input now reach the loop as HostEvents, as keys and text did in W5b (#1487). The Magic Remote's cursor hide moves behind the platform's Shell. webOS hides and shows the pointer exactly as before. The desktop and the host-test platform hide nothing, which is what the simulator already did.

What changes

  • HostEvent::Pointer { x: f32, y: f32, edge: PointerEdge }, where PointerEdge is Move, Down or Up, and HostEvent::Wheel { dy: i32 }.

    • decode_host_event (app/events.rs) maps SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP to Pointer, and SDL_MOUSEWHEEL to Wheel.
    • x and y are logical coordinates, from plx_base::surface::to_logical. At 1920x1080 that is the identity. Because they are floats, HostEvent keeps PartialEq but loses Eq.
    • decode_wheel_dy keeps the existing wheel-offset handling and its comment. Under hostsim it reads the float at +32 and rounds it; otherwise it reads the Sint32 at +20.
  • The plan proposed Pointer { x, y, buttons, shown }. This lands without buttons and shown:

    • The loop never read which button was pressed: the edge is the SDL event type alone, whatever the button. the_edge_is_the_event_type_whatever_the_button_bytes_say pins that.
    • Whether the pointer is shown is the pointer machine's own cur_hidden, not event data.
  • ingest_host_event (app/run.rs) handles both events through ingest_pointer_{motion,down,up} and ingest_wheel. Effect order, the recorder rows (enc_pointer, and ("wheel", 0, dy) after the 250 ms debounce) and the drop of real input under a controlled replay do not change.

  • The cursor hide. app/boot.rs gives up hide_cursor, cursor_is_transparent, show_cursor_after_motion, hide_through, show_through, SHOWN_CURSOR, CursorDoor and cursor_door to rust-modules/src/system.rs. system already sits in [platform webos], so no module is added.

    • Shell gains hide_pointer, show_pointer_after_motion and hide_is_cursor_swap.
    • WebosShell forwards each one to system. DesktopShell and HostShell are no-ops and answer hide_is_cursor_swap false. A test-only SwapShell counts its calls and says true.
    • Callers in input.rs, playback.rs (through a new Bridge::shell()) and run.rs reach the hide through the shell.
    • Apart from the cfg lines, the television's code paths are unchanged. The hostsim gates and arms are gone, the three wrappers are safe fns, and wl_sym is renamed self_sym.
    • SHOWN_CURSOR moves with no new ledger line.
    • boot.rs keeps the pre-SDL_Init cursor sleep hint (webos3_cursor_sleep_hint, cursor_sleep_hint, its own self_sym) and its source-order pins.
  • feature = "hostsim" occurrences. The ones on the moved cursor functions go from 13 to 0. Across the touched files the count goes from 99 to 89:

    file before after
    boot.rs 52 39
    run.rs 27 26
    events.rs 8 12

    events.rs rises by one production cfg! in decode_wheel_dy and three test-only gates.

  • Carried from Keys and text reach the loop as a HostEvent with a canonical Action #1487's review:

    • The press() helper's vacuous armed assertions now observe the real press with is_live, with a direction-key control.
    • The "minted by plex_run" prose is fixed. The main-thread token is minted in enter_application. The fix covers base/src/task.rs, media/src/player/{adapter,mod}.rs, dev.rs, docs/async-model-decision.md, docs/agent-reference.md and docs/remote-keys.md.
    • The docs/agent-reference.md fuzz wording is fixed.

Tests

  • Decode:
    • pointer_event_tests: the edge and position; the edge ignoring the button bytes; the synthesized bytes round-tripping; the wheel offset at +20; the FIFO token's television-shaped wheel decoding to 0 under hostsim; and, under hostsim, a fractional trackpad tick rounding to whole ticks.
    • host_event_tests.
  • The loop (lifecycle_regression_tests, hostsim):
    • pointer and wheel take the paths their SDL events took;
    • the D-pad motion gate;
    • OK-as-click under a cursor swap, and its button-up;
    • the D-pad hiding the pointer through the shell, and a motion showing it again;
    • the recorder rows;
    • the wheel FIFO token;
    • the controlled-replay drop.
  • The hide door:
    • system::cursor_door_tests, five tests, not gated;
    • input::pointer_hide_tests;
    • the shells' own tests in platform.rs and platform_desktop.rs.
  • Mutations. 21 mutants were applied one at a time, and each was killed by the test aimed at it.
    • No mutant exists for the three one-line WebosShell forwards or for the sync_back_cursor call in playback.rs, because the host cannot observe them.

    • Three more call sites are moved verbatim but no test guards them:

      • the idle-over-video hide in run.rs's playback_tick (shell.hide_pointer() after 3000 ms without motion);
      • host_background's sync_back_cursor;
      • controlled_key_input's note_cursor_motion.

      SwapShell could now observe them, but no test drives those paths on it. Deleting any one of them fails no test.

Results on the committed tree at 17d0574, after merging main at f7038a8 (W6b #1489, which contains #1488 and #1490):

  • Full hostsim suite, without the two tests that kill the test binary on the lane's Mac at base too: test result: ok. 1781 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
  • Default-feature suite, the same way: test result: ok. 1514 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
  • make test-hostsim T=uri_boot: test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 1754 filtered out
  • make test-crate C=plxnative-modules:
    • T=port::tests: test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1513 filtered out
    • T=pointer: test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 1497 filtered out
    • T=cursor_door: test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 1510 filtered out
  • make check-nodef: exit 0. make lint was exit 0 on b7ec914; the only edit since the merge is a test-only line.
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0
  • The merge needed one fix: SwapShell::platform() passes MediaBoot::HOST_TEST to W6b's four-argument Platform::new. the_host_test_platform_answers_nothing_and_says_so destructures all four Platform fields.

Results on b0ad245, before the merge:

  • Full hostsim suite, without the two tests that kill the test binary on the lane's Mac at base too: test result: ok. 1774 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
    • The skipped tests are player_owner_events_record_and_replay_through_the_actual_app_host and an_unregistered_product_screen_uses_generic_navigation_and_actual_store_effects.
  • Default-feature suite, the same way: test result: ok. 1509 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0
  • tests/keytable.json is unchanged.
  • ci/check-deps.sh, ci/check-module-layers.py, ci/check-ledger-ratchet.py and ci/check-statics.sh are green.
  • ci/test_readonly_generated.py and ci/test_readonly_dependencies.py pass.
  • No change under ci/, to any Cargo file or .cargo, or to rust-modules/src/lib.rs.
  • fw-compat-reviewer: no findings. It graded the source only. The same SDL_* symbols are looked up in the same order, with the same hide method per firmware release. The 3.x releases sit below the graded floor.
  • doc-claim-auditor: five findings, all fixed.

Not covered

  • No television run. Not checked on a set: the pointer hide and show on a 3.x set against a 4.5+ set, the WebosShell forwards, and the Back sync in playback.rs.
  • The wheel:<dy> FIFO token. It builds the television's +20 layout, so under hostsim it decodes to 0. This was already true before this PR, and a test now pins it.

🤖 Generated with Claude Code

GLinnik21 and others added 7 commits November 20, 2026 15:59
…er hide moves behind Shell

W5c of the platform plan (discussion #1460). The Magic Remote's pointer and the wheel were the last
input the loop still read from SDL's raw bytes. The SDL decoder now turns a pointer motion, a button
down and a button up into HostEvent::Pointer { x, y, edge } at authored 1920x1080 coordinates, and a
wheel tick into HostEvent::Wheel { dy }, with the sdl2-compat carrier (the count at +32 as a float on
the simulator, at +20 as an integer on the television, and why +20 decodes to 0 there) moved into the
decoder unchanged. The loop's reaction (the D-pad motion gate, OK-as-click, the back-cursor sync, hover
and focus, the recorder rows and the wheel's debounce) is the same code in the same order, now in
ingest_pointer and ingest_wheel behind the one consumer, ingest_host_event. The tape, InputKind, the
machines, tests/keytable.json and the FIFO and Lab pointer alphabet are untouched.

The plan's Pointer { x, y, buttons, shown } is carried as { x, y, edge }: SDL gives the loop no
buttons or shown field it reads (a held button is the loop's own state, set by the down and up
edges; LG's own hide arrives as a key and a show is a motion), so inventing them would carry nothing.
Coordinates are f32, so HostEvent no longer derives Eq.

The Magic Remote hide (hide_cursor, cursor_is_transparent, show_cursor_after_motion, the cursor door
and its remembered cursor) leaves app/boot.rs for the webOS port's own system.rs, with its tests, and
the loop reaches it through Shell::hide_pointer, Shell::show_pointer_after_motion and
Shell::hide_is_cursor_swap. WebosShell carries the webOS bodies verbatim; DesktopShell and the
host-test shell answer as the simulator always did (no hide, not a swap). The hostsim gates on those
functions go away, so the host builds the same cursor code as the television.

Tests: the decode table for every pointer and wheel byte shape (both layouts, the +20 case), the
D-pad gate at 119 and exactly 120 px, OK-as-click under a cursor swap against a real click, the hide
and show counted on the platform's shell, the tape rows, the wheel's debounce, and the wheel:<dy>
token through SDL's own queue. The W5b guard that armed a local Press nothing reached is replaced by
one that observes the real press armed by a click and left alone by an unbound key.

Prose: the main-thread token is minted by enter_application, which both entries reach through
run_application, not by plex_run; the fuzz package's plx_media/hostsim is the host configuration of
the layers below it, not the Feed backend's host sink.

Co-Authored-By: Claude <noreply@anthropic.com>
…ay drop get their own tests

The W5b guard that armed a local Press nothing reached could not fail; it now arms the dispatcher's
real press with a click, sends an unbound key through the loop's key ingress and reads is_live (an
abandoned press stays active while it springs back), with a direction key as the control that does
abandon it. The wheel:<dy> token test follows the carrier of the SDL it runs on (sdl2-compat returns
the count at +32, genuine SDL2 returns the bytes as pushed), so it holds on the Linux CI job too. A
real pointer or wheel event under a controlled replay is dropped as a key is, and the live loop is
the control. The implicit-machines audit's pointer to SHOWN_CURSOR says where it moved.

Co-Authored-By: Claude <noreply@anthropic.com>
The counting shell and the loop's hide tests sat only behind the hostsim feature, so the default test
build had no reader for them and no test of what the pointer machine asks of the shell. The swap
shell is now pinned where no feature gate hides it, and the pointer machine's hide and show (the
first direction key hides once, a motion shows once, Back's own hide is restored only when Back made
it) are counted on it in both builds.

Co-Authored-By: Claude <noreply@anthropic.com>
The doc audit of the W5c diff found sentences the change made untrue: remote-keys.md still said the
unsupported-key invariant is graded twice and by a module that no longer observes the press, input.rs
named a test that does not exist, module-layers.md listed the shell's consumers without the pointer's
callers, system.rs called a block that lost its hostsim arms verbatim, and the fw-compat reviewer's
prompt pointed at boot.rs for the cursor symbols that now resolve in system.rs. Two older claims that
plex_run runs the loop and owns the boot gate now name run_and_shutdown and boot, where they live. The
desktop platform's module doc is rewrapped.

Co-Authored-By: Claude <noreply@anthropic.com>
… the loop

The counting shell's pin called pump_bus to show that a shell call that is no pointer call is not
counted, and check-deps's frame gate allows pump_bus, opaque_route and clear_opaque_region to be named
only in app/run.rs. The pin now uses release_surface for that, which says the same thing and is not one
of the three.

Co-Authored-By: Claude <noreply@anthropic.com>
W8a's storage group (`storage: StorageHooks::NONE` and the test that the desktop keeps the account in
files) and this branch's desktop pointer methods and their test now sit side by side in the desktop
platform; the module doc names both. Nothing else conflicted.

Co-Authored-By: Claude <noreply@anthropic.com>
…inter and wheel branch

W6b's `Platform.media` (the `MediaBoot` the platform supplies, and `Platform::new` taking it as its
fourth argument) and this branch's `Shell` pointer methods and `SwapShell` now sit together. Git merged
them without a conflict, but the counting shell's platform still built a platform from three parts, so
it passes `MediaBoot::HOST_TEST` like the host-test platform does.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit fb35a0e into main Nov 20, 2026
14 checks passed
@GLinnik21
GLinnik21 deleted the platform/w5c-pointer-wheel branch November 20, 2026 14:52
GLinnik21 added a commit that referenced this pull request Nov 20, 2026
…#1493)

This is a docs follow-up to the platform plan (discussion #1460). It corrects the sentences that W8a (#1488, #1490, #1491) and W5c (#1492) made false. It is prose only, plus one code comment.

- rust-modules/plex/src/plex/CLAUDE.md and the session/persistence.rs module doc:
  - Seven public dispatchers hand the authority and NativeTransport to a *_via form.
  - cleanup_temporaries goes through cleanup_temporaries_for(authority) with no transport. Its Helper arm sweeps nothing.
- docs/module-layers.md:
  - L15e reads "W5a to W5c and W6b landed".
  - L15g reads "W8a started" (#1488, #1490, #1491).
- docs/platform-ports.md:
  - F39 says telemetry was re-keyed first, in #1490.
  - In Target shape 4, the gate sits above the storage-authority selection, not a target_arch selection.
  - The HostEvent list gains an "As landed (W5c)" note: Pointer { x, y, edge } and Wheel { dy }, with no buttons or shown field.
- rust-modules/os/src/storage/mod.rs: the comment on StoreError's allow(dead_code) no longer claims a compiled-out half. Both arms compile on every build. No variant warns without the allow, because the enum is public and the storage module allows dead_code. The attribute is unchanged.

Two review minors are left for W6's docs, which edit the same row:
- The L15g row does not name telemetry's nine native.rs crash-capture sites, the follow-up for Tizen ARM retail builds.
- The row does not say that the storage-authority part of W8a ran ahead of W7.

plex/Cargo.toml's stale hostsim comment is certificate-pinned and goes with W8c.
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