Fix #1147: DWM blur in Windows 10 and 11

This commit is contained in:
Paddy
2022-06-14 22:13:08 +02:00
parent df4f642b51
commit 7c8655aff3
3 changed files with 32 additions and 6 deletions

View File

@@ -46,6 +46,8 @@ namespace QuickLook
}
public IViewer Plugin { get; private set; }
public ContextObject ContextObject { get; private set; }
public Themes CurrentTheme {get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
@@ -84,11 +86,13 @@ namespace QuickLook
if (isDark)
{
CurrentTheme = Themes.Dark;
if (!Resources.MergedDictionaries.Contains(_darkDict))
Resources.MergedDictionaries.Add(_darkDict);
}
else
{
CurrentTheme = Themes.Light;
if (Resources.MergedDictionaries.Contains(_darkDict))
Resources.MergedDictionaries.Remove(_darkDict);
}

View File

@@ -102,14 +102,36 @@ namespace QuickLook
{
base.OnApplyTemplate();
WindowHelper.RemoveWindowControls(this);
if (SettingHelper.Get("UseTransparency", true)
&& SystemParameters.IsGlassEnabled
&& (App.IsWin10 || App.IsWin11)
&& !App.IsGPUInBlacklist
)
WindowHelper.EnableBlur(this);
&& !App.IsGPUInBlacklist)
{
if (App.IsWin11)
{
if (Environment.OSVersion.Version >= new Version(10, 0, 22523))
{
WindowHelper.EnableBackdropMicaBlur(this, CurrentTheme == Themes.Dark);
}
else
{
WindowHelper.EnableMicaBlur(this, CurrentTheme == Themes.Dark);
}
}
else if (App.IsWin10)
{
WindowHelper.EnableBlur(this);
}
else
{
Background = (Brush)FindResource("MainWindowBackgroundNoTransparent");
}
}
else
Background = (Brush) FindResource("MainWindowBackgroundNoTransparent");
{
Background = (Brush)FindResource("MainWindowBackgroundNoTransparent");
}
}
private void SaveWindowSizeOnSizeChanged(object sender, SizeChangedEventArgs e)