Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions Flow.Launcher.Core/Resource/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@
var (backdropType, useDropShadowEffect) = GetActualValue();

// Remove OS minimizing/maximizing animation
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3);

Check warning on line 605 in Flow.Launcher.Core/Resource/Theme.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`FORCEDISABLED` is not a recognized word. (unrecognized-spelling)

Check warning on line 605 in Flow.Launcher.Core/Resource/Theme.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`DWMWA` is not a recognized word. (unrecognized-spelling)

Check warning on line 605 in Flow.Launcher.Core/Resource/Theme.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`DWMWINDOWATTRIBUTE` is not a recognized word. (unrecognized-spelling)

// The timing of adding the shadow effect should vary depending on whether the theme is transparent.
if (BlurEnabled)
Expand Down Expand Up @@ -646,7 +646,7 @@
backdropType = BackdropTypes.None;
}

// Dropshadow on and control disabled.(user can't change dropshadow with blur theme)

Check warning on line 649 in Flow.Launcher.Core/Resource/Theme.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`dropshadow` is not a recognized word. (unrecognized-spelling)

Check warning on line 649 in Flow.Launcher.Core/Resource/Theme.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Dropshadow` is not a recognized word. (unrecognized-spelling)
if (BlurEnabled)
{
useDropShadowEffect = true;
Expand All @@ -670,16 +670,20 @@
bool hasBlur = dict.Contains("ThemeBlurEnabled") && dict["ThemeBlurEnabled"] is bool b && b;
if (BlurEnabled && hasBlur && Win32Helper.IsBackdropSupported())
{
// If the BackdropType is Mica or MicaAlt, set the windowborderstyle's background to transparent

Check warning on line 673 in Flow.Launcher.Core/Resource/Theme.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`windowborderstyle` is not a recognized word. (unrecognized-spelling)
if (backdropType == BackdropTypes.Mica || backdropType == BackdropTypes.MicaAlt)
{
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Color.FromArgb(1, 0, 0, 0))));
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property == Control.BackgroundProperty));
var brush = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
brush.Freeze();
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, brush));
}
else if (backdropType == BackdropTypes.Acrylic)
{
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property == Control.BackgroundProperty));
var brush = new SolidColorBrush(Colors.Transparent);
brush.Freeze();
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, brush));
}

// For themes with blur enabled, the window border is rendered by the system, so it's treated as a simple rectangle regardless of thickness.
Expand Down Expand Up @@ -803,7 +807,9 @@

// Apply background color (remove transparency in color)
Color backgroundColor = Color.FromRgb(bgColor.Value.R, bgColor.Value.G, bgColor.Value.B);
previewStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(backgroundColor)));
var brush = new SolidColorBrush(backgroundColor);
brush.Freeze();
previewStyle.Setters.Add(new Setter(Border.BackgroundProperty, brush));

// The blur theme keeps the corner round fixed (applying DWM code to modify it causes rendering issues).
// The non-blur theme retains the previously set WindowBorderStyle.
Expand Down Expand Up @@ -917,11 +923,15 @@
// Only set the background to transparent if the theme supports blur
if (backdropType == BackdropTypes.Mica || backdropType == BackdropTypes.MicaAlt)
{
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
var backgroundBrush = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
backgroundBrush.Freeze();
mainWindow.Background = backgroundBrush;
}
else
{
mainWindow.Background = new SolidColorBrush(selectedBG);
var backgroundBrush = new SolidColorBrush(selectedBG);
backgroundBrush.Freeze();
mainWindow.Background = backgroundBrush;
}
}
}
Expand Down
Loading