Repository navigation
Follow the Character to the display it is on - #56
Conversation
cf722d9 to
da80c2e
Compare
|
Rebased onto
#49 and this PR both touch |
Machine-specific auditTwo defects found, both in FixedThe props were measured from the wrong rectangle. The harness placed the Perch 200 points and the furniture 60 points below the centre of The drops were fixed points. The one assumption left is named in the comment: about 350 points of usable height, enough for the Perch to take its 80-point step and stay on screen. Every display macOS runs on clears that.
Checked and cleared
Out of scope, for whoever owns it
Verification
Ready to merge. |
|
Follow-up on the crossing frame flagged in the audit. I tried the suggested fix, measured it, and reverted it. The suggestion. Measured, on a synthetic drag across the boundary with #49 merged in:
No difference. The The single off-window frame out of ~460 is the asynchronous move landing. It is the same 16ms artifact already recorded as the Worth recording that the two PRs compose: merging #49 and this one conflicts only in the import block of |
Dragging the Character across a display boundary lost it. The Engine never did: the frame trace shows it following the cursor onto the second display and coming to rest on that display's floor. The window lost it. macOS gives each display its own Space and draws a window spanning two of them on only one, so an overlay sized to the union of every display frame is invisible on every display but the one it happens to belong to. The Character was being drawn the whole time, where nobody could see it. The overlay now covers one display, and the frame loop moves it to whichever display the Character's feet are on. Physics is untouched -- it still runs in the one point space every display shares. Which display that is comes from `overlay::display_for`, which answers with the nearest when the point is in a gap between displays or past the outermost edge, so a cursor between screens still leaves the overlay somewhere. The per-tick `primary_monitor()` call goes with it. It read `NSScreen` from the frame loop, which only the main thread may do, and the scale factor it fetched now arrives from the same cached main-thread read as the display frames. Without this, a Character dragged onto a second display is gone until it is dragged back blind, and every desktop with more than one display has screens the Character cannot be seen on at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The `display_for` fixture was called `mixed_dpi` and documented as "the desktop the sprite went missing on". That points at hardware, and `display_for` never sees a scale factor: it compares rectangles in points, so DPI is not what the test covers. A reader has to check the values to find out whether the test depends on the machine running it. It does not. Both fixtures now say what arrangement they describe and that the values are literals. Where a scale factor is the subject, in `in_points`, the doc keeps the conversion and drops the hardware. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The verification harness placed its prop windows a fixed number of points below the centre of the first display's whole frame. The sprite starts at the centre of that display's usable frame instead, so the gap between the two was whatever this desktop's menu bar and Dock happened to make it, and a fixed drop past a shorter display's bottom edge is a window macOS will not place, which reads as a frame loop that never noticed a move. Both props are now measured from the same usable frame the app starts the sprite in, at fractions of the room between the sprite and the floor. The one assumption left is stated: about 350 points of usable height, which every display macOS runs on clears. Also accepts more than one matching display for the overlay's rectangle. Mirrored displays report the same rectangle, and two matches there is one answer said twice rather than a window spanning two screens. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
7839646 to
708c52d
Compare
`docs/agents/comments.md` covers code comments. The same drift shows up in commit messages, pull request descriptions and review replies, and nothing written down covered those. Pull request #56 opened on "Not the arithmetic — the window.", a sentence built for effect rather than to state a fact, and the repo owner rejected it by hand. Without the rule written down the next contributor repeats it, and the owner corrects it by hand again. The prose rules are identical across the four surfaces, so they are stated once. A sibling document rather than a section in `comments.md`, because a file named for code comments is a surprising place to find the rule about commit subjects. Closes #63 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`window_source` handed every non-macOS platform `StubWindowSource` and an empty `DisplayCache`, so the Shell knew of no displays at all. Since #56 the setup hook calls `display_for` over `displays.read().frames` and returns `Err("no displays reported")` when it finds none, so a Linux build panics at startup — and before #56 it started with no floor and no walls, and the sprite fell out of the world on the first tick. `docs/SPEC.md` and DESIGN.md both call this a supported degraded mode rather than an error state. `read_displays` was gated on macOS although its body is portable Tauri — `available_monitors`, `work_area`, `scale_factor`. Ungated, it feeds a source that reports the usable frames and no windows, which is what screen-edge physics is. `Capabilities::default()` declares no `window_geometry`, so `snapshot()` keeps the windows cleared. No test: the arm needs a real window server, and the arithmetic it feeds (`in_points`, `usable_frame`, `starting_position`, `display_for`) is already covered in `crates/core`. The Linux CI leg compiles it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The overlay now covers one display and follows the Character onto whichever display it is on. Dragging the Character to a second display used to lose it. macOS gives each display its own Space, and a window spanning two Spaces renders on only one, so a union-sized overlay drew the Character on a display that was never composited.
The first diagnosis was wrong
The first diagnosis blamed the cursor conversion: one scale factor applied across two different physical spaces.
docs/SPEC.md:513lists that bug class among the four that earned this repo's testing rule, so it is a fair suspicion. It is not this bug.tao-0.35.3/src/platform_impl/macos/util/mod.rs:101returns global points multiplied by the primary display's scale factor and nothing else. Dividing by that factor recovers points exactly, on any mix of DPIs. The trace agreed: the Character came to rest atpos(2600,1117)on display 2, over bare wallpaper.The real cause
A bare
NSPanelspanning both displays, with an opaque square over each, rendered only the square on the first display. That held at floating level and at screen-saver level alike. The reproduction uses no ai-buddy code.What changed
overlay::display_forpicks that display. It returns the containing display, or the nearest one when the point falls in a gap or past the outermost edge.display_unionis deleted.window_source::in_pointsreplaces the per-display conversion inside it, andusable_frameshares it.primary_monitor()call is gone. It readNSScreenoff the main thread, which is not allowed. The cursor's scale factor now comes from the same cached main-thread read as the display frames.Supersedes a written decision
docs/SPEC.mdandDESIGN.mdspecify a union-sized overlay. macOS cannot provide one. Four places move with the code:docs/SPEC.md:298DESIGN.md§14DESIGN.mddecision 24scripts/verify-overlay.shKnown limitation
The sprite is clipped while it straddles the seam between two displays, because one window cannot be on both.
place_spritecentres the art on the contact point, so the clip is at most half the rendered width, or 64 points for the placeholder Character. The compromise is markedponytail:in the code, with one overlay per display as the upgrade.Verify
verify-overlay.shpasses on a real two-display desktop, including the rewritten bounds check:window covers exactly one display 1920x1080 at (0,0). The old assertion passes on the broken build and fails on the fixed one, so it was replaced rather than added to.A synthetic drag ran from
(960,950)on display 1 to(2600,500)on display 2, over 10,328 traced frames. The overlay was on the Character's display in every frame but one: the 16ms tick at the crossing, while the asynchronous window move lands. Final window bounds were1728x1117 at (1920,0), sprite window-local at(616,989).#49 also touches
main.rs,platform.rsandREADME.md. Whichever of the two merges second needs a rebase.Closes #55
🤖 Generated with Claude Code