mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix Preview border
This commit is contained in:
parent
e527e6c918
commit
fd344a35b0
2 changed files with 57 additions and 42 deletions
|
|
@ -236,36 +236,36 @@ namespace Flow.Launcher.Core.Resource
|
|||
}
|
||||
|
||||
|
||||
public void SetCornerForWindow()
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
var dict = GetThemeResourceDictionary(_settings.Theme);
|
||||
if (dict == null)
|
||||
return;
|
||||
//public void SetCornerForWindow()
|
||||
//{
|
||||
// Application.Current.Dispatcher.Invoke(() =>
|
||||
// {
|
||||
// var dict = GetThemeResourceDictionary(_settings.Theme);
|
||||
// if (dict == null)
|
||||
// return;
|
||||
|
||||
System.Windows.Window mainWindow = Application.Current.MainWindow;
|
||||
if (mainWindow == null)
|
||||
return;
|
||||
// System.Windows.Window mainWindow = Application.Current.MainWindow;
|
||||
// if (mainWindow == null)
|
||||
// return;
|
||||
|
||||
if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode)
|
||||
{
|
||||
DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch
|
||||
{
|
||||
"DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound,
|
||||
"Round" => DWM_WINDOW_CORNER_PREFERENCE.Round,
|
||||
"RoundSmall" => DWM_WINDOW_CORNER_PREFERENCE.RoundSmall,
|
||||
_ => DWM_WINDOW_CORNER_PREFERENCE.Default,
|
||||
};
|
||||
// if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode)
|
||||
// {
|
||||
// DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch
|
||||
// {
|
||||
// "DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound,
|
||||
// "Round" => DWM_WINDOW_CORNER_PREFERENCE.Round,
|
||||
// "RoundSmall" => DWM_WINDOW_CORNER_PREFERENCE.RoundSmall,
|
||||
// _ => DWM_WINDOW_CORNER_PREFERENCE.Default,
|
||||
// };
|
||||
|
||||
SetWindowCornerPreference(mainWindow, preference);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default);
|
||||
}
|
||||
}, DispatcherPriority.Normal);
|
||||
}
|
||||
// SetWindowCornerPreference(mainWindow, preference);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default);
|
||||
// }
|
||||
// }, DispatcherPriority.Normal);
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -389,7 +389,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
// 1. 기존 WindowBorderStyle을 복사
|
||||
// ✅ 기존 WindowBorderStyle을 복사
|
||||
var previewStyle = new Style(typeof(Border));
|
||||
if (Application.Current.Resources.Contains("WindowBorderStyle"))
|
||||
{
|
||||
|
|
@ -403,16 +403,23 @@ namespace Flow.Launcher.Core.Resource
|
|||
}
|
||||
}
|
||||
|
||||
// 2. 투명도 제거 후 background 적용
|
||||
// ✅ 배경색 적용 (투명도 제거)
|
||||
Color backgroundColor = Color.FromRgb(bgColor.Value.R, bgColor.Value.G, bgColor.Value.B);
|
||||
previewStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(backgroundColor)));
|
||||
|
||||
// 3. 기타 설정 추가
|
||||
previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(0)));
|
||||
previewStyle.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(5)));
|
||||
previewStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
|
||||
previewStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
|
||||
// ✅ 블러 테마면 CornerRadius = 5, 비블러 테마면 기존 스타일 유지
|
||||
if (BlurEnabled)
|
||||
{
|
||||
previewStyle.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(5)));
|
||||
previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(1)));
|
||||
}
|
||||
|
||||
// ✅ 기타 설정 추가
|
||||
//previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(1)));
|
||||
//previewStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
|
||||
//reviewStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
|
||||
|
||||
// ✅ 최종 적용
|
||||
Application.Current.Resources["PreviewWindowBorderStyle"] = previewStyle;
|
||||
}, DispatcherPriority.Render);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,20 +35,23 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
_selectedTheme = value;
|
||||
ThemeManager.Instance.ChangeTheme(value.FileNameWithoutExtension);
|
||||
|
||||
// ✅ 테마 변경 후 BackdropType 자동 업데이트
|
||||
// ✅ 비블러 테마로 변경 시 BackdropType을 None으로 자동 설정
|
||||
if (!ThemeManager.Instance.BlurEnabled)
|
||||
{
|
||||
Settings.BackdropType = BackdropTypes.None;
|
||||
}
|
||||
|
||||
// ✅ 블러 테마에서는 DropShadow를 자동으로 켜고 비활성화 (사용자 변경 불가)
|
||||
if (ThemeManager.Instance.BlurEnabled)
|
||||
{
|
||||
Settings.UseDropShadowEffect = true;
|
||||
}
|
||||
|
||||
// ✅ UI 상태 업데이트
|
||||
OnPropertyChanged(nameof(BackdropType));
|
||||
OnPropertyChanged(nameof(IsBackdropEnabled));
|
||||
|
||||
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect == false)
|
||||
{
|
||||
DropShadowEffect = true;
|
||||
OnPropertyChanged(nameof(IsDropShadowEnabled));
|
||||
}
|
||||
OnPropertyChanged(nameof(IsDropShadowEnabled));
|
||||
OnPropertyChanged(nameof(DropShadowEffect));
|
||||
|
||||
ThemeManager.Instance.RefreshFrame();
|
||||
}
|
||||
|
|
@ -61,12 +64,14 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
get => Settings.UseDropShadowEffect;
|
||||
set
|
||||
{
|
||||
if (ThemeManager.Instance.BlurEnabled && value == false)
|
||||
if (ThemeManager.Instance.BlurEnabled)
|
||||
{
|
||||
// 🔥 블러 테마에서는 항상 DropShadowEffect = true 유지
|
||||
Settings.UseDropShadowEffect = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// ✅ 비블러 테마에서는 사용자가 수동으로 변경 가능
|
||||
if (value)
|
||||
{
|
||||
ThemeManager.Instance.AddDropShadowEffectToCurrentTheme();
|
||||
|
|
@ -77,6 +82,9 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
}
|
||||
|
||||
Settings.UseDropShadowEffect = value;
|
||||
|
||||
// ✅ UI 업데이트
|
||||
OnPropertyChanged(nameof(DropShadowEffect));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue