Skip to content

fix: capture a window's visible frame, not its invisible border - #156

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/window-frame-bounds
Oct 25, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
fix/window-frame-bounds

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

`window:<title>` bounds came from `GetWindowRect`, which on Windows 10/11 includes the invisible resize border (about 8 px a side). Every window capture was edged with a strip of whatever sat behind the window: other apps, the desktop. That is a privacy problem for a tool whose output gets shared. Found while making example media for the #129 cookbook.

Bounds now come from `DwmGetWindowAttribute(DWMWA_EXTENDED_FRAME_BOUNDS)`, the visible frame, falling back to `GetWindowRect` if DWM fails. The process is already per-monitor DPI aware, so these are physical pixels, matching gdigrab.

Test: the live harness opens a form with a 500 px client area and checks the capture is 500–504 px wide. It captured 516 before this change and 502 after. Bumps to 0.27.2.

🤖 Generated with Claude Code

GetWindowRect includes the ~8 px invisible resize border on Windows 10/11,
so window: captures showed a strip of whatever was behind the window.
Use DWMWA_EXTENDED_FRAME_BOUNDS, falling back to GetWindowRect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TMHSDigital
TMHSDigital merged commit 4b4c32f into main Oct 25, 2026
8 checks passed
@TMHSDigital
TMHSDigital deleted the fix/window-frame-bounds branch October 25, 2026 13:39
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