[Always On Top] Render a solid border frame - #49698
Merged
Clint Rutkas (crutkas) merged 1 commit intoAug 7, 2026
Merged
Conversation
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
Clint Rutkas (crutkas)
marked this pull request as ready for review
August 6, 2026 21:58
Member
Author
Boliang Zhang (LegendaryBlair)
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
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
src\modules\alwaysontop\AlwaysOnTop\AlwaysOnTop.vcxprojfor Debug x64 successfully.PowerToys.AlwaysOnTop.exewith frame opacity 100%, thickness 4, and rounded corners enabled.WS_EX_TOPMOST.AlwaysOnTop_BorderHWND sized 946x627 behind the 960x630 target window.Residual limitation: the RDP input desktop was detached, so composed-screen pixel capture was unavailable.
winappcould 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.