set blur when theme change is called

This commit is contained in:
Jeremy 2021-06-29 07:00:01 +10:00
parent 52fbebf2d6
commit aa34a0202d
4 changed files with 4 additions and 16 deletions

View file

@ -30,10 +30,6 @@ namespace Flow.Launcher.Core.Resource
public bool BlurEnabled { get; set; }
// due to blur only enabled when main window is loaded for the first time, this is used to track the blur status
// when the window is first loaded and prompt user that a restart is required for blur to take effect.
public bool BlurEnabledOnloaded { get; set; }
public Theme()
{
_themeDirectories.Add(DirectoryPath);
@ -98,6 +94,8 @@ namespace Flow.Launcher.Core.Resource
if (Settings.UseDropShadowEffect && !BlurEnabled)
AddDropShadowEffectToCurrentTheme();
SetBlurForWindow();
}
catch (DirectoryNotFoundException e)
{
@ -356,6 +354,8 @@ namespace Flow.Launcher.Core.Resource
private void SetWindowAccent(Window w, AccentState state)
{
var windowHelper = new WindowInteropHelper(w);
w.Width = 750;
windowHelper.EnsureHandle();
var accent = new AccentPolicy { AccentState = state };
var accentStructSize = Marshal.SizeOf(accent);

View file

@ -40,7 +40,6 @@
<system:String x:Key="ShouldUsePinyin">Should Use Pinyin</system:String>
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for transliterating Chinese</system:String>
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
<system:String x:Key="blurEffectRequireRestart">Current theme has blur effect enabled for the first time, a restart is required in order to take effect</system:String>
<!--Setting Plugin-->
<system:String x:Key="plugin">Plugin</system:String>

View file

@ -61,11 +61,6 @@ namespace Flow.Launcher
// show notify icon when flowlauncher is hidden
InitializeNotifyIcon();
// currently blur can only be called when loading main window.
// is there a way to set blur only once?
ThemeManager.Instance.SetBlurForWindow();
ThemeManager.Instance.BlurEnabledOnloaded = ThemeManager.Instance.BlurEnabled;
WindowsInteropHelper.DisableControlBox(this);
InitProgressbarAnimation();
InitializePosition();

View file

@ -274,12 +274,6 @@ namespace Flow.Launcher.ViewModel
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect)
DropShadowEffect = false;
if (!ThemeManager.Instance.BlurEnabledOnloaded && ThemeManager.Instance.BlurEnabled)
{
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("blurEffectRequireRestart"));
ThemeManager.Instance.BlurEnabledOnloaded = true;
}
}
}