Skip to content

Commit 7cf0b97

Browse files
committed
Move DWM corner preference, WindowBorderStyle removal, and resize border reset from AutoDropShadow to SetBlurForWindow
- AutoDropShadow is now simplified to only handle adding or removing the drop shadow effect. - The WindowBorderStyle removal, and resize border reset were just cleanup for SetBlurForWindow so make more sense to be there. - The Corner prefernce was only really a binary choice between blur enabled or not - so SetBlurForWindow can also handle that.
1 parent ae93f8b commit 7cf0b97

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -718,41 +718,42 @@ private void SetBlurForWindow(string theme, BackdropTypes backdropType)
718718
// Apply the blur effect
719719
Win32Helper.DWMSetBackdropForWindow(mainWindow, backdropType);
720720
ColorizeWindow(theme, backdropType);
721+
722+
// DWM renders rounded corners for backdrop windows
723+
SetWindowCornerPreference("Round");
724+
725+
// Clear any stale directly-set WindowBorderStyle that might shadow
726+
// the merged dictionary entry we just modified above.
727+
if (Application.Current.Resources.Contains("WindowBorderStyle"))
728+
Application.Current.Resources.Remove("WindowBorderStyle");
729+
730+
// For blur themes the resize border defaults to the system thickness.
731+
SetResizeBoarderThickness(null);
721732
}
722733
else
723734
{
724735
// Apply default style when Blur is disabled
725736
Win32Helper.DWMSetBackdropForWindow(mainWindow, BackdropTypes.None);
726737
ColorizeWindow(theme, backdropType);
738+
739+
// Non-blur themes use the default window corner preference
740+
SetWindowCornerPreference("Default");
727741
}
728742

729743
UpdateResourceDictionary(dict);
730744
}
731745

732746
private void AutoDropShadow(bool useDropShadowEffect)
733747
{
748+
if (BlurEnabled)
749+
return; // Blur themes have no drop shadow effect
750+
734751
if (useDropShadowEffect)
735752
{
736-
if (BlurEnabled && Win32Helper.IsBackdropSupported())
737-
{
738-
// Blur themes: DWM handles corners. Clear any stale directly-set
739-
// resource so the merged dictionary entry (from SetBlurForWindow) wins.
740-
SetWindowCornerPreference("Round");
741-
if (Application.Current.Resources.Contains("WindowBorderStyle"))
742-
Application.Current.Resources.Remove("WindowBorderStyle");
743-
SetResizeBoarderThickness(null);
744-
}
745-
else
746-
{
747-
// For themes without blur, we set corner preference to default and add drop shadow effect.
748-
SetWindowCornerPreference("Default");
749-
AddDropShadowEffectToCurrentTheme();
750-
}
753+
AddDropShadowEffectToCurrentTheme();
751754
}
752755
else
753756
{
754-
// When drop shadow effect is disabled, we set corner preference to default and remove drop shadow effect.
755-
SetWindowCornerPreference("Default");
756757
RemoveDropShadowEffectFromCurrentTheme();
757758
}
758759
}

0 commit comments

Comments
 (0)