Skip to content

Commit b5d372e

Browse files
committed
Refactor AutoDropShadow logic for clarity and correctness
Simplified the AutoDropShadow method to avoid redundant operations and improve readability. Now, window corner preference and drop shadow effects are set based on blur and backdrop support, with clear comments explaining each case. Removed convoluted branching for more direct logic.
1 parent 916b4ff commit b5d372e

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -706,30 +706,27 @@ private void SetBlurForWindow(string theme, BackdropTypes backdropType)
706706

707707
private void AutoDropShadow(bool useDropShadowEffect)
708708
{
709-
SetWindowCornerPreference("Default");
710-
RemoveDropShadowEffectFromCurrentTheme();
711709
if (useDropShadowEffect)
712710
{
713711
if (BlurEnabled && Win32Helper.IsBackdropSupported())
714712
{
713+
// For themes with blur enabled, the window border is rendered by the system,
714+
// so we set corner preference to round and remove drop shadow effect to avoid rendering issues.
715715
SetWindowCornerPreference("Round");
716+
RemoveDropShadowEffectFromCurrentTheme();
716717
}
717718
else
718719
{
720+
// For themes without blur, we set corner preference to default and add drop shadow effect.
719721
SetWindowCornerPreference("Default");
720722
AddDropShadowEffectToCurrentTheme();
721723
}
722724
}
723725
else
724726
{
725-
if (BlurEnabled && Win32Helper.IsBackdropSupported())
726-
{
727-
SetWindowCornerPreference("Default");
728-
}
729-
else
730-
{
731-
RemoveDropShadowEffectFromCurrentTheme();
732-
}
727+
// When drop shadow effect is disabled, we set corner preference to default and remove drop shadow effect.
728+
SetWindowCornerPreference("Default");
729+
RemoveDropShadowEffectFromCurrentTheme();
733730
}
734731
}
735732

0 commit comments

Comments
 (0)