Skip to content

Commit fd344a3

Browse files
committed
Fix Preview border
1 parent e527e6c commit fd344a3

File tree

2 files changed

+60
-45
lines changed

2 files changed

+60
-45
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -236,36 +236,36 @@ public void SetWindowCornerPreference(string cornerType)
236236
}
237237

238238

239-
public void SetCornerForWindow()
240-
{
241-
Application.Current.Dispatcher.Invoke(() =>
242-
{
243-
var dict = GetThemeResourceDictionary(_settings.Theme);
244-
if (dict == null)
245-
return;
246-
247-
System.Windows.Window mainWindow = Application.Current.MainWindow;
248-
if (mainWindow == null)
249-
return;
250-
251-
if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode)
252-
{
253-
DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch
254-
{
255-
"DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound,
256-
"Round" => DWM_WINDOW_CORNER_PREFERENCE.Round,
257-
"RoundSmall" => DWM_WINDOW_CORNER_PREFERENCE.RoundSmall,
258-
_ => DWM_WINDOW_CORNER_PREFERENCE.Default,
259-
};
260-
261-
SetWindowCornerPreference(mainWindow, preference);
262-
}
263-
else
264-
{
265-
SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default);
266-
}
267-
}, DispatcherPriority.Normal);
268-
}
239+
//public void SetCornerForWindow()
240+
//{
241+
// Application.Current.Dispatcher.Invoke(() =>
242+
// {
243+
// var dict = GetThemeResourceDictionary(_settings.Theme);
244+
// if (dict == null)
245+
// return;
246+
247+
// System.Windows.Window mainWindow = Application.Current.MainWindow;
248+
// if (mainWindow == null)
249+
// return;
250+
251+
// if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode)
252+
// {
253+
// DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch
254+
// {
255+
// "DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound,
256+
// "Round" => DWM_WINDOW_CORNER_PREFERENCE.Round,
257+
// "RoundSmall" => DWM_WINDOW_CORNER_PREFERENCE.RoundSmall,
258+
// _ => DWM_WINDOW_CORNER_PREFERENCE.Default,
259+
// };
260+
261+
// SetWindowCornerPreference(mainWindow, preference);
262+
// }
263+
// else
264+
// {
265+
// SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default);
266+
// }
267+
// }, DispatcherPriority.Normal);
268+
//}
269269

270270

271271
/// <summary>
@@ -389,7 +389,7 @@ private void ApplyPreviewBackground(Color? bgColor = null)
389389

390390
Application.Current.Dispatcher.Invoke(() =>
391391
{
392-
// 1. 기존 WindowBorderStyle을 복사
392+
// 기존 WindowBorderStyle을 복사
393393
var previewStyle = new Style(typeof(Border));
394394
if (Application.Current.Resources.Contains("WindowBorderStyle"))
395395
{
@@ -403,16 +403,23 @@ private void ApplyPreviewBackground(Color? bgColor = null)
403403
}
404404
}
405405

406-
// 2. 투명도 제거 후 background 적용
406+
// ✅ 배경색 적용 (투명도 제거)
407407
Color backgroundColor = Color.FromRgb(bgColor.Value.R, bgColor.Value.G, bgColor.Value.B);
408408
previewStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(backgroundColor)));
409409

410-
// 3. 기타 설정 추가
411-
previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(0)));
412-
previewStyle.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(5)));
413-
previewStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
414-
previewStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
410+
// ✅ 블러 테마면 CornerRadius = 5, 비블러 테마면 기존 스타일 유지
411+
if (BlurEnabled)
412+
{
413+
previewStyle.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(5)));
414+
previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(1)));
415+
}
416+
417+
// ✅ 기타 설정 추가
418+
//previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(1)));
419+
//previewStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
420+
//reviewStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
415421

422+
// ✅ 최종 적용
416423
Application.Current.Resources["PreviewWindowBorderStyle"] = previewStyle;
417424
}, DispatcherPriority.Render);
418425
}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,24 @@ public Theme.ThemeData SelectedTheme
3535
_selectedTheme = value;
3636
ThemeManager.Instance.ChangeTheme(value.FileNameWithoutExtension);
3737

38-
// ✅ 테마 변경 후 BackdropType 자동 업데이트
38+
// ✅ 비블러 테마로 변경 시 BackdropType을 None으로 자동 설정
3939
if (!ThemeManager.Instance.BlurEnabled)
4040
{
4141
Settings.BackdropType = BackdropTypes.None;
4242
}
4343

44-
OnPropertyChanged(nameof(BackdropType));
45-
OnPropertyChanged(nameof(IsBackdropEnabled));
46-
47-
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect == false)
44+
// ✅ 블러 테마에서는 DropShadow를 자동으로 켜고 비활성화 (사용자 변경 불가)
45+
if (ThemeManager.Instance.BlurEnabled)
4846
{
49-
DropShadowEffect = true;
50-
OnPropertyChanged(nameof(IsDropShadowEnabled));
47+
Settings.UseDropShadowEffect = true;
5148
}
5249

50+
// ✅ UI 상태 업데이트
51+
OnPropertyChanged(nameof(BackdropType));
52+
OnPropertyChanged(nameof(IsBackdropEnabled));
53+
OnPropertyChanged(nameof(IsDropShadowEnabled));
54+
OnPropertyChanged(nameof(DropShadowEffect));
55+
5356
ThemeManager.Instance.RefreshFrame();
5457
}
5558
}
@@ -61,12 +64,14 @@ public bool DropShadowEffect
6164
get => Settings.UseDropShadowEffect;
6265
set
6366
{
64-
if (ThemeManager.Instance.BlurEnabled && value == false)
67+
if (ThemeManager.Instance.BlurEnabled)
6568
{
69+
// 🔥 블러 테마에서는 항상 DropShadowEffect = true 유지
6670
Settings.UseDropShadowEffect = true;
6771
return;
6872
}
6973

74+
// ✅ 비블러 테마에서는 사용자가 수동으로 변경 가능
7075
if (value)
7176
{
7277
ThemeManager.Instance.AddDropShadowEffectToCurrentTheme();
@@ -77,6 +82,9 @@ public bool DropShadowEffect
7782
}
7883

7984
Settings.UseDropShadowEffect = value;
85+
86+
// ✅ UI 업데이트
87+
OnPropertyChanged(nameof(DropShadowEffect));
8088
}
8189
}
8290

0 commit comments

Comments
 (0)