fix: set WindowDrawnDecorations background to transparent#21354
Conversation
|
You can test this PR using the following package version. |
|
|
@cla-avalonia agree |
f7e9f1d to
cf20c4b
Compare
|
You can test this PR using the following package version. |
MrJul
left a comment
There was a problem hiding this comment.
The changes make sense, the window's background will always be on top of the underlay anyway.
LGTM!
|
Did you mean to say that the title bar shouldn't be transparent when TransparencyLevelHint is None? |
|
|
Also, titlebar being transparent doesn't match what we have with macOS when client area is extended. |
|
We should probably have a flag to disable titlebar background uniformly across platforms in client area extension mode |
|
Thanks for clarifying. I understand the issue now. Avalonia/src/Avalonia.X11/X11Window.cs Line 1544 in 9d4c952 Instead of adding a new flag, how about we make the background brush conditional? We can make it transparent only when ExtendClientAreaToDecorationsHint=True and a transparency effect is active (WindowTransparencyLevel != None). This keeps the public API minimal, protects Linux CSD, and aligns with the macOS behavior when transparency is off. A simple implementation would be:
<Style Selector="^:has-transparency /template/ Border#PART_WindowBorder">
<Setter Property="Background" Value="{DynamicResource SystemControlTransparentBrush}" />
</Style>
<Style Selector="^:has-transparency /template/ Panel#PART_TitleBar">
<Setter Property="Background" Value="{DynamicResource SystemControlTransparentBrush}" />
</Style>I'd be happy to submit another PR if that sounds agreeable. |



What does the pull request do?
Fixes a regression where
WindowDrawnDecorationsused an opaque background, blocking transparency effects (Mica/Acrylic/Blur) whenExtendClientAreaToDecorationsHintis enabled.What is the current behavior?
WindowDrawnDecorationsrenders a solid background, obscuring the window's transparency effects whenExtendClientAreaToDecorationsHint="True".What is the updated/expected behavior with this PR?
WindowDrawnDecorationsbackgrounds are now transparent , allowing the window background to show through correctly.Proof (ExtendClientArea = True):
How was the solution implemented?
WindowDrawnDecorationsContent.Underlaybackgrounds toSystemControlTransparentBrushinAvalonia.Themes.Fluent/Controls/WindowDrawnDecorations.xaml.WindowDrawnDecorationsContent.Underlaybackgrounds toTransparentinAvalonia.Themes.Simple/Controls/WindowDrawnDecorations.xaml.Checklist
Fixed issues
Fixes #21082