Skip to content

Commit f0999fd

Browse files
committed
Merge pull request AvaloniaUI#7787 from AvaloniaUI/fixes/mica-acrylic-fallback-win32
make mica fallback to acrylic on compatible windows 10
1 parent e84a13f commit f0999fd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Avalonia.Controls/WindowTransparencyLevel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public enum WindowTransparencyLevel
2222
/// </summary>
2323
AcrylicBlur,
2424

25+
/// <summary>
26+
/// Force acrylic on some incompatible versions of Windows 10.
27+
/// </summary>
28+
ForceAcrylicBlur,
29+
2530
/// <summary>
2631
/// The window background is based on desktop wallpaper tint with a blur. This will only work on Windows 11
2732
/// </summary>

src/Windows/Avalonia.Win32/WindowImpl.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ private WindowTransparencyLevel Win10EnableBlur(WindowTransparencyLevel transpar
394394
}
395395
}
396396

397+
if (Win32Platform.WindowsVersion.Major == 10 && effect == BlurEffect.Mica)
398+
{
399+
effect = BlurEffect.Acrylic;
400+
}
401+
397402
_blurHost?.SetBlur(effect);
398403

399404
return transparencyLevel;
@@ -426,7 +431,8 @@ private WindowTransparencyLevel Win10EnableBlur(WindowTransparencyLevel transpar
426431
break;
427432

428433
case WindowTransparencyLevel.AcrylicBlur:
429-
case (WindowTransparencyLevel.AcrylicBlur + 1): // hack-force acrylic.
434+
case WindowTransparencyLevel.ForceAcrylicBlur: // hack-force acrylic.
435+
case WindowTransparencyLevel.Mica:
430436
accent.AccentState = AccentState.ACCENT_ENABLE_ACRYLIC;
431437
transparencyLevel = WindowTransparencyLevel.AcrylicBlur;
432438
break;

0 commit comments

Comments
 (0)