Fix borders and shadows on Windows 10 in extended mode#21412
Merged
Conversation
|
You can test this PR using the following package version. |
4afe7f5 to
f501581
Compare
|
You can test this PR using the following package version. |
emmauss
approved these changes
May 28, 2026
MrJul
added a commit
to MrJul/Avalonia
that referenced
this pull request
May 28, 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.
What does the pull request do?
This PR fixes
ExtendClientAreaToDecorationsHint="True"not displaying shadows and borders on Windows 10 correctly whenWindowDecorationsisFullorBorderOnly.What is the current behavior?
Borders and shadows, drawn by the OS, are missing when
ExtendClientAreaToDecorationsHintistrueon Windows 10 and Windows Server 2019/2022.What is the updated/expected behavior with this PR?
The borders and shadows are displayed.
How was the solution implemented (if it's not obvious)?
In #20217, I made sure that extended and non-extended modes result in the exact same window styles, as it was very hard to reason about which styles were effectively applied before.
However, on Windows versions older than build 22000 (< Windows 11), DWM still draws the full caption when
WS_CAPTIONis specified, even if we reserved only a single pixel border for it. Windows 11 respects that correctly. To resolve this issue, the non-client rendering policy (DWMWA_NCRENDERING_POLICY) was set toDWMNCRP_DISABLEDon these older versions. Doing so caused the shadows and borders not to be rendered, which was missed.Plus, it turns out that the non-client rendering policy gets automatically reverted when WGL is used on Windows 10, so it wasn't really a good solution.
Rather than piling workarounds, this PR now removes the
WS_CAPTIONstyle in this case. The NC rendering policy is set toDWMNCRP_ENABLEDin all cases, causing the borders and shadows to be displayed on all Windows versions.All integration tests related to
ExtendClientAreaToDecorationsHintare still passing.Fixed issues