Skip to content

[Always On Top] Render a solid border frame - #49698

Merged
Clint Rutkas (crutkas) merged 1 commit into
microsoft:mainfrom
crutkas:crutkas-fix-aot-solid-border
Aug 7, 2026
Merged

[Always On Top] Render a solid border frame#49698
Clint Rutkas (crutkas) merged 1 commit into
microsoft:mainfrom
crutkas:crutkas-fix-aot-solid-border

Conversation

@crutkas

Copy link
Copy Markdown
Member

Summary of the Pull Request

Fixes the Always On Top frame appearing mottled or translucent even when frame opacity is set to 100%.

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

The frame helper window is intentionally placed behind the tracked window. The previous Direct2D rendering used a centered stroke, so the tracked window occluded the stroke's inner half. With per-primitive antialiasing enabled, partial-coverage pixels became disproportionately visible in the remaining thin outer half, making a fully opaque frame look mottled.

This change replaces the centered stroke with a filled, even-odd outer/inner geometry ring. It preserves configured opacity, the transparent interior, DPI-scaled frame thickness and corner radius, smooth rounded corners, and target-window occlusion while limiting antialiasing to the ring's actual contours.

It also recreates render-target-bound brush resources when the HWND render target is recreated, clears stale resources on D2DERR_RECREATE_TARGET, and redraws when rectangle or corner geometry changes.

Validation Steps Performed

  • Built src\modules\alwaysontop\AlwaysOnTop\AlwaysOnTop.vcxproj for Debug x64 successfully.
  • Ran the freshly built PowerToys.AlwaysOnTop.exe with frame opacity 100%, thickness 4, and rounded corners enabled.
  • Pinned a controlled Win32 window and confirmed it received WS_EX_TOPMOST.
  • Confirmed the module created an AlwaysOnTop_Border HWND sized 946x627 behind the 960x630 target window.
  • Restored the temporary setting change and stopped the test processes.

Residual limitation: the RDP input desktop was detached, so composed-screen pixel capture was unavailable. winapp could capture the layered border HWND only by flattening transparency to black, which is not trustworthy visual pixel evidence. An interactive-desktop visual check is still recommended.

Render the frame as a filled Direct2D geometry ring so antialiasing is limited to the contours and the visible border remains solid behind the target window. Recreate target-bound resources after device loss.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c2697877-8736-4e8d-add3-06ed2cec15b9
@crutkas
Clint Rutkas (crutkas) marked this pull request as ready for review August 6, 2026 21:58
@crutkas

Copy link
Copy Markdown
Member Author

manually verified border is now solid again
image

@crutkas
Clint Rutkas (crutkas) merged commit ddeb7f1 into microsoft:main Aug 7, 2026
15 checks passed
@crutkas
Clint Rutkas (crutkas) deleted the crutkas-fix-aot-solid-border branch August 7, 2026 04:13
@LegendaryBlair Boliang Zhang (LegendaryBlair) added the Product-Always On Top Refers to the idea of a Always on Top Powertoy label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Always On Top Refers to the idea of a Always on Top Powertoy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants