Skip to content

Place Linux snips in each monitor's pixels - #11

Merged
DevanMetz merged 5 commits into
mainfrom
grok/mixed-dpi
Oct 28, 2026
Merged

DevanMetz merged 5 commits into
mainfrom
grok/mixed-dpi

Conversation

@DevanMetz

Copy link
Copy Markdown
Owner

What changed

Linux snips are placed in each monitor's pixels.

  • The selection is one borderless window per screen, sized to that screen's scale, instead of one window stretched across the desktop.
  • A drag that leaves its window uses the X11 root pointer, so a 1x screen beside a 2x screen stays in desktop pixels. Wayland still extends the press window's coordinates, which is exact only when both screens share a scale.
  • X11 capture reads the XRandR bounding box, including outputs left of or above the origin, and the frame records that origin. If the server rejects the rectangle, the grab falls back to the root window at (0, 0).
  • PARITY.md lists every Windows feature and setting against this branch.

Windows behavior is unchanged. F and A still select without completing, and Esc still cancels the whole snip.

Why

A mixed-DPI desktop was the remaining gap in the Windows claim that a snip is the pixels you see. One scaled window cannot represent two scales at once.

How it was tested

  • DISPLAY=:1 dotnet test tests/OpenSnip.Tests/OpenSnip.Tests.csproj -c Release — 20 passed. The suite covers mixed-DPI mapping (a 1920×1080 DIP window on a 3840×2160 monitor), selection gestures, and a live X11 capture whose size and origin match XRRGetMonitors.
  • On this machine's single 1920×1200 X11 screen the overlay was exactly 1920x1200+0+0. A drag from (180, 160) to (520, 460) saved a 341×301 PNG (inclusive edges). A click saved 1920×1200. F then Enter saved 1920×1200. Escape saved nothing.
  • There is no second scale and no Wayland display here, so those paths are covered by the mapping tests only. The Windows project was not built; this branch does not change it.

linux/AssemblyInfo.cs, the test project, and the Linux dotnet test step overlap the open X11 loader PR. Both add the same InternalsVisibleTo.

A 1x screen beside a 2x screen cannot share one scale. The new map
crops a matching frame 1:1, including monitors at negative coordinates,
and spreads any other frame uniformly across the desktop. Arrow keys
move one desktop pixel.
A single overlay stretched mixed-DPI desktops. Each monitor now gets its own window, and drags that leave it use the X11 root pointer so the crop stays in desktop pixels.
XRRGetMonitors supplies the bounding box, including monitors left of or above (0, 0). The frame records that origin so the overlay crops 1:1. A rejected grab falls back to the root window.
PARITY.md lists each Windows feature and setting. The README notes per-monitor scale and X11 outputs outside the origin.
# Conflicts:
#	.github/workflows/build.yml
#	PARITY.md
#	README.md
#	linux/App.cs
#	linux/OverlayWindow.cs
#	linux/X11Pointer.cs
#	tests/OpenSnip.Tests/X11PointerTests.cs
@DevanMetz
DevanMetz merged commit 1d2992f into main Oct 28, 2026
2 checks passed
@DevanMetz
DevanMetz deleted the grok/mixed-dpi branch October 28, 2026 00:41
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