Skip to content

Commit 90828d9

Browse files
committed
Fix Shadow Timing
1 parent f0b1422 commit 90828d9

File tree

3 files changed

+38
-27
lines changed

3 files changed

+38
-27
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,26 @@ public void RefreshFrame()
153153

154154
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
155155
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
156-
157-
if (!_settings.UseDropShadowEffect && BlurEnabled)
158-
{
159-
_settings.UseDropShadowEffect = true;
160-
AddDropShadowEffectToCurrentTheme();
161-
}
162156

163-
if (_settings.UseDropShadowEffect)
164-
{
165-
AddDropShadowEffectToCurrentTheme();
166-
}
157+
//if (!_settings.UseDropShadowEffect && BlurEnabled)
158+
//{
159+
// _settings.UseDropShadowEffect = true;
160+
// AddDropShadowEffectToCurrentTheme();
161+
//}
162+
163+
//if (_settings.UseDropShadowEffect)
164+
//{
165+
// AddDropShadowEffectToCurrentTheme();
166+
//}
167+
//AutoDropShadow();
168+
SetBlurForWindow();
169+
167170
//else if (!_settings.usedropshadoweffect && blurenabled)
168171
//{
169172
// adddropshadoweffecttocurrenttheme();
170173
// _settings.usedropshadoweffect = true;
171174
//}
172-
SetBlurForWindow();
175+
173176
//SetCornerForWindow();
174177
}
175178

@@ -185,6 +188,7 @@ public void AutoDropShadow()
185188
}
186189
else
187190
{
191+
SetWindowCornerPreference("Default");
188192
Debug.WriteLine("이거는 블러없는 테마");
189193
AddDropShadowEffectToCurrentTheme();
190194
}
@@ -247,6 +251,7 @@ public void SetCornerForWindow()
247251
/// </summary>
248252
public void SetBlurForWindow()
249253
{
254+
//AutoDropShadow();
250255
//SetWindowAccent();
251256
var dict = GetThemeResourceDictionary(_settings.Theme);
252257
if (dict == null)
@@ -265,6 +270,7 @@ public void SetBlurForWindow()
265270
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
266271
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
267272
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
273+
SetWindowCornerPreference("Round");
268274
}
269275
else
270276
{
@@ -274,10 +280,24 @@ public void SetBlurForWindow()
274280
// windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
275281
//}
276282
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 1);
283+
SetWindowCornerPreference("Default");
284+
if (_settings.UseDropShadowEffect)
285+
{
286+
287+
AddDropShadowEffectToCurrentTheme();
288+
}
289+
else
290+
{
291+
RemoveDropShadowEffectFromCurrentTheme();
292+
}
277293

278294
}
279295
ThemeModeColor(BlurMode());
296+
280297
UpdateResourceDictionary(dict);
298+
299+
300+
281301
}
282302

283303
// WindowBorderStyle에서 Background 색상 가져오는 함수
@@ -403,6 +423,7 @@ public void ThemeModeColor(string Mode)
403423
}
404424
else
405425
{
426+
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
406427
mainWindow.Background = new SolidColorBrush(Colors.Transparent);
407428
}
408429
}
@@ -716,14 +737,9 @@ private string GetThemePath(string themeName)
716737

717738
public void AddDropShadowEffectToCurrentTheme()
718739
{
719-
SetWindowCornerPreference("Default");
720-
if (BlurEnabled)
721-
{
722-
SetWindowCornerPreference("Round");
723-
}
724-
else
725-
{
726-
var dict = GetCurrentResourceDictionary();
740+
741+
//SetWindowCornerPreference("Default");
742+
var dict = GetCurrentResourceDictionary();
727743

728744
var windowBorderStyle = dict["WindowBorderStyle"] as Style;
729745

@@ -768,13 +784,12 @@ public void AddDropShadowEffectToCurrentTheme()
768784
windowBorderStyle.Setters.Add(effectSetter);
769785

770786
UpdateResourceDictionary(dict);
771-
}
787+
772788
}
773789

774790
public void RemoveDropShadowEffectFromCurrentTheme()
775791
{
776-
SetWindowCornerPreference("Default");
777-
792+
778793
var dict = GetCurrentResourceDictionary();
779794
//mainWindow.WindowStyle = WindowStyle.None;
780795
var windowBorderStyle = dict["WindowBorderStyle"] as Style;

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ public MainWindow(Settings settings, MainViewModel mainVM)
6767
var win = HwndSource.FromHwnd(handle);
6868
win.AddHook(WndProc);
6969
};
70-
if (_settings.UseDropShadowEffect == false) /* Shadow Effect */
71-
{
72-
FlowMainWindow.WindowStyle = WindowStyle.None;
73-
FlowMainWindow.AllowsTransparency = true;
74-
}
7570
}
7671

7772
DispatcherTimer timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 500), IsEnabled = false };

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public Theme.ThemeData SelectedTheme
3838
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect == false)
3939
DropShadowEffect = true;
4040
ThemeManager.Instance.RefreshFrame();
41+
//ThemeManager.Instance.SetBlurForWindow();
4142
}
4243
}
4344

0 commit comments

Comments
 (0)