Skip to content

fix: correct X11 target overlay sizing at high DPI - #2590

Merged
richiemcilroy merged 5 commits into
CapSoftware:mainfrom
jatmn:fix/x11-hidpi-overlay-2323
Oct 24, 2026
Merged

richiemcilroy merged 5 commits into
CapSoftware:mainfrom
jatmn:fix/x11-hidpi-overlay-2323

Conversation

@jatmn

@jatmn jatmn commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2323 in the current GPUI desktop app.

On X11, scap-targets exposes RandR bounds in physical pixels, while GPUI interprets window bounds as logical points. At Xft.dpi=192, a 2560×1600 display therefore opened a 5120×3200 target overlay, leaving its controls off-screen.

Convert X11 capture coordinates to GPUI points for overlay sizing, work-area placement, and window highlights, and convert selected areas back to capture coordinates. Use GPUI's actual X11 scale factor; other backends retain their existing coordinate convention.

Validated on a real X11 server (Xvfb, Debian, software Vulkan):

  • Reproduced the oversized overlay on unchanged main before implementation.
  • Overlay measures 2560×1600 at 96, 144, and 192 DPI; the main UI retains its scaling.
  • A 300×200-point area at 192 DPI captures the expected 600×400 pixels and exact fixture contents. Before the fix it captured 300×200 pixels from the wrong region. Window highlighting also aligns with a known native window.
  • cargo +1.95.0 fmt --all -- --check
  • cargo +1.95.0 check --locked -p cap-desktop-gpui
  • Additional strict Clippy check reports the same 17 existing diagnostics on unchanged main and this patch; none are in the changed code.
  • Full desktop tests: 1,185 passed, 8 existing ignored. An initial unchanged process-lifecycle test hit ETXTBSY; the complete rerun passed.
  • Kernel tests: 26 passed, 1 existing ignored.
  • CI preparation and packaging tests: 94 passed, 1 skipped.

Mint/MATE hardware and other operating systems were not exercised locally. The existing GPUI X11 two-pixel origin offset is outside this size correction.

Native X11 at 192 DPI, before and after

Original overlay validation commit: f0a8217aebc363e1beaa67d43c7727aef22a8e45.

Area-camera placement follow-up

Keep the camera-placement crop in GPUI logical coordinates; the native X11 window setter applies DPI scaling. Recording capture coordinates keep their conversion.

Reproduced and verified in native X11 (Xvfb/Openbox, Ubuntu 24.04, software Vulkan):

  • At 192 DPI, the original preview window was at (3108, 1996), outside the 2560×1600 display and the selected (200, 100, 1600, 1200) region. After the one-line correction it is at (1308, 696) with size 460×572, fully inside that same selection.
  • 96 DPI produces identical native window bounds before and after; 144 DPI also passes containment after the fix.
  • The fixture opens the production preview window without a camera feed through a temporary startup hook. Placement and X11 window configuration are production code; live video capture was not tested, and the hook is not included in this PR.
  • The repaired checkout passes cargo +1.95.0 fmt --all -- --check and cargo +1.95.0 check --locked -p cap-desktop-gpui.

Camera repair reviewed and locally validated at 873e97767e922726173dd49d72d17f9cc4daba59.

Maintainer-requested branch refresh

Removed apps/desktop-gpui/docs/x11-overlay-hidpi.png from the branch and merged main at 36627a505e53f9f1584ebca8df146fe5738c4d68. The screenshot above remains available at its original commit URL. The original two-file X11 DPI patch is preserved.

Validated merged head 4f2fa65b35c98174c464c611d28589e8e1e3aae4 on Linux with Rust 1.95.0: cargo check --manifest-path apps/desktop-gpui/Cargo.toml --locked -p cap-desktop-gpui passed. Root Rust 1.88.0 formatting and formatting of both PR Rust files passed. Full GPUI formatting reports existing import order in settings_pages.rs and indentation in snapshot.rs; both files are unchanged from main and excluded from this repair. Native GUI and full cross-platform tests were not rerun locally for this merge.

CI has started on the refreshed head. Under the existing path filters, the GPUI platform jobs run while Clippy and root Rust tests (Linux) are skipped for this GPUI-only diff.

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Corrects X11 target overlays at high DPI.

  • The X11 target picker fits the display and captures the selected area.

The target merge bases differ, so this review used the full PR diff. No previous review threads were supplied. No actionable new issues were found. Native GUI checks and tests were not rerun.

Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/x11-hidpi-o..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@jatmn
jatmn marked this pull request as ready for review October 14, 2026 21:09
@richiemcilroy

Copy link
Copy Markdown
Member

@jatmn thanks for tracking this down, the X11 conversion looks right and stays out of the macOS and Windows paths. One small thing before we merge: could you drop apps/desktop-gpui/docs/x11-overlay-hidpi.png from the branch? It is only referenced by the PR description (which already links it by commit SHA, so the image keeps working), and we would rather not ship it in the repo. Could you also merge main in so the Clippy and Linux Rust test jobs run on the latest head? Thanks!

@richiemcilroy

Copy link
Copy Markdown
Member

@greptileai review

@richiemcilroy
richiemcilroy merged commit e1f0869 into CapSoftware:main Oct 24, 2026
39 of 41 checks passed
@jatmn
jatmn deleted the fix/x11-hidpi-overlay-2323 branch October 24, 2026 13:49
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.

Linux/X11 HiDPI: full-screen recording overlay is ~2x too large at 200% scale

2 participants