Skip to content

fix(gpui): preserve screenshot annotations across layout edits - #3342

Open
himanshu748 wants to merge 2 commits into
CapSoftware:mainfrom
himanshu748:fix/gpui-screenshot-annotation-geometry
Open

himanshu748 wants to merge 2 commits into
CapSoftware:mainfrom
himanshu748:fix/gpui-screenshot-annotation-geometry

Conversation

@himanshu748

@himanshu748 himanshu748 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Changing a screenshot's aspect ratio, padding, or crop can leave saved annotations different from the preview, move them again when undoing, or delete an edge mask before the new frame arrives. For example, changing an 800×600 screenshot to Square moves a rectangle from y=100 to y=200 in the preview, but the saved snapshot still contains y=100; Undo can then move it to y=0.

Compute annotation coordinates synchronously using the renderer's aligned preview dimensions, before mask clipping, history recording, and saving. Restoring history installs the saved geometry directly. Rendered frames only update presentation and must match the current revision and dimensions.

During a geometry change, the existing loading preview remains visible until the matching frame and mask overlays are ready. History restoration cancels pending mask work so a late result cannot replace the restored mask.

Validation:

  • Executable isolated checks: 17 passed on the final patch; the shared baseline had one pass and five expected failures, including incorrect saved coordinates, double transformation on Undo, and a mask deleted by padding. The harness extracts production methods and uses real project types, history, mask clipping, and disk write/load. GPUI, renderer publication, and asynchronous filtering are stubbed; the ownership check uses a mock task, so it does not prove native task cancellation.
  • Added eight Linux GPUI regressions covering aspect/history, annotation-only undo, save/reopen, crop/padding masks, stale frames, equal-size crop changes, asynchronous mask readiness, and cancellation of an in-flight mask completion. Added a pure test for odd-size output alignment. These tests have not compiled or run locally.
  • Native workspace formatting, scoped rustfmt checks, and git diff --check passed. Formatter-only changes outside the two intended files were removed.
  • The scoped application check was stopped during dependency compilation after the missing ALSA prerequisite was confirmed. A focused alsa-sys check exits 101 because pkg-config cannot find alsa.pc.
  • Interactive application behavior and rendered export pixels remain unverified locally. No performance claim is made.

Configured native test commands:

cargo test --manifest-path apps/desktop-gpui/Cargo.toml -p cap-desktop-gpui --bin cap-gpui annotation_geometry
cargo test --manifest-path apps/desktop-gpui/Cargo.toml -p cap-desktop-gpui --bin cap-gpui annotation_layout_uses_the_renderers_aligned_preview_dimensions
cargo test --manifest-path apps/desktop-gpui/Cargo.toml -p cap-desktop-gpui --bin cap-gpui history_invalidation_cancels_a_pending_mask_completion

Native CI on 479934d46a18c1f7c2dd5a8aaa925eff6e939af1: Linux GPUI CI passes all eight new GPUI regressions and the dimension test, including mask readiness and actual in-flight task cancellation (1,557 app tests passed, zero failures). Native app suites and the dimension regression also pass on Windows (1,433), Apple Silicon (1,474), and Intel macOS (1,469). The eight interaction tests are Linux-only. CI tested a merge of this exact head into base f6046f1.

All five Actions workflows completed successfully: CI, Engine verify, Verify recording, Perf budget, and Linux desktop reliability (GNOME, NixOS, niri and Hyprland). Both GitHub-required checks, Engine verify and Verify recording, pass. Vercel's two deployment statuses require maintainer authorization and are separate from code validation. No manual GUI session or rendered export pixel comparison was performed locally.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Computes screenshot annotation coordinates before clipping masks, recording history, and saving.

  • Screenshot layout edits keep annotation coordinates in sync with the saved layout.
  • The preview waits for the current frame and masks after a layout edit.

Review checks were based on source and test inspection. No native tests or interactive GUI checks were run during this review.

Reviews (1) · Last reviewed commit: "fix(gpui): preserve screenshot annotatio..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@himanshu748 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

@himanshu748
himanshu748 marked this pull request as ready for review October 26, 2026 07:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T07:41:39.638492Z
We couldn’t complete this review. Comment @codex review to try again.
479934d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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