mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix Blink issue when hidestartup mode (hide on)
This commit is contained in:
parent
2710de1fbc
commit
46cdb2a273
4 changed files with 37 additions and 25 deletions
|
|
@ -140,6 +140,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
if (mainWindowSrc == null)
|
||||
return;
|
||||
|
||||
|
||||
ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS();
|
||||
margins.cxLeftWidth = -1;
|
||||
margins.cxRightWidth = -1;
|
||||
|
|
@ -153,8 +154,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
|
||||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||
|
||||
// The timing of adding the shadow effect should vary depending on whether the theme is transparent.
|
||||
if (BlurEnabled)
|
||||
// The timing of adding the shadow effect should vary depending on whether the theme is transparent. if (BlurEnabled)
|
||||
{
|
||||
AutoDropShadow();
|
||||
}
|
||||
|
|
@ -164,6 +164,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
{
|
||||
AutoDropShadow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AutoDropShadow()
|
||||
|
|
@ -248,6 +249,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
var windowBorderStyle = dict["WindowBorderStyle"] as Style;
|
||||
if (windowBorderStyle == null)
|
||||
return;
|
||||
|
||||
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||
if (BlurEnabled)
|
||||
{
|
||||
|
|
@ -255,9 +257,9 @@ namespace Flow.Launcher.Core.Resource
|
|||
//BlurColor(BlurMode());
|
||||
Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~");
|
||||
Debug.WriteLine(BlurMode());
|
||||
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
|
||||
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
|
||||
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
|
||||
//SetWindowCornerPreference("Round");
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -815,12 +815,23 @@ namespace Flow.Launcher
|
|||
public void HideStartup()
|
||||
{
|
||||
UpdatePosition();
|
||||
|
||||
if (_settings.HideOnStartup)
|
||||
{
|
||||
_viewModel.Hide();
|
||||
// 📌 최초 실행 시 창이 깜빡이는 문제 방지 (완전히 숨긴 상태로 시작)
|
||||
System.Windows.Application.Current.MainWindow.Visibility = Visibility.Hidden;
|
||||
|
||||
Dispatcher.BeginInvoke((Action)(() =>
|
||||
{
|
||||
_viewModel.Hide();
|
||||
System.Windows.Application.Current.MainWindow.Visibility = Visibility.Collapsed;
|
||||
}), DispatcherPriority.Background);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 📌 최초 실행 시 그림자 효과를 미리 적용하여 Show() 할 때 렌더링이 느려지지 않도록 함
|
||||
ThemeManager.Instance.SetBlurForWindow();
|
||||
//ThemeManager.Instance.AutoDropShadow();
|
||||
_viewModel.Show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
|
||||
<system:String x:Key="BlurMode">Light</system:String>
|
||||
<system:String x:Key="CornerType">RoundSmall</system:String>
|
||||
<Color x:Key="lightBG">#DDFEC7D7</Color>
|
||||
<Color x:Key="darkBG">#DDFEC7D7</Color>
|
||||
<Color x:Key="lightBG">#4BFEC7D7</Color>
|
||||
<Color x:Key="darkBG">#53FEC7D7</Color>
|
||||
<Thickness x:Key="ResultMargin">0 0 0 0</Thickness>
|
||||
<Style
|
||||
x:Key="ItemGlyph"
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
BasedOn="{StaticResource BaseWindowBorderStyle}"
|
||||
TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="8" />
|
||||
<Setter Property="Background" Value="#fec7d7" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="BorderBrush" Value="#0e172c" />
|
||||
</Style>
|
||||
|
|
|
|||
|
|
@ -1402,22 +1402,22 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
IntPtr hWnd = new WindowInteropHelper(mainWindow).Handle;
|
||||
|
||||
// 📌 창을 먼저 보이게 설정
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
// 📌 창을 보이도록 설정 (Cloak 사용 안 함)
|
||||
//ShowWindow(hWnd, SW_SHOW);
|
||||
|
||||
// 📌 UI 요소 복원
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Visible;
|
||||
mainWindow.SearchIcon.Visibility = Visibility.Visible;
|
||||
// 📌 DWM Cloak 해제 (즉시 표시)
|
||||
int cloak = 0;
|
||||
DwmSetWindowAttribute(hWnd, DWMWA_CLOAK, ref cloak, sizeof(int));
|
||||
}
|
||||
|
||||
// WPF 속성 업데이트
|
||||
//MainWindowOpacity = 1;
|
||||
MainWindowVisibility = Visibility.Visible;
|
||||
MainWindowVisibilityStatus = true;
|
||||
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public async void Hide()
|
||||
{
|
||||
lastHistoryIndex = 1;
|
||||
|
|
@ -1432,7 +1432,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||
{
|
||||
// 📌 아이콘과 시계 Opacity를 0으로 강제 설정하고 Visibility.Hidden 적용 (쿼리 상태와 관계없이 실행)
|
||||
// 📌 아이콘과 시계 Opacity를 0으로 설정하고 Visibility.Hidden 적용
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
mainWindow.ClockPanel.Opacity = 0;
|
||||
|
|
@ -1445,7 +1445,7 @@ namespace Flow.Launcher.ViewModel
|
|||
mainWindow.SearchIcon.UpdateLayout();
|
||||
}, DispatcherPriority.Render);
|
||||
|
||||
await Task.Delay(10); // UI 반영 대기
|
||||
//await Task.Delay(10); // UI 반영 대기
|
||||
}
|
||||
|
||||
// 📌 텍스트 초기화 즉시 적용 + UI 강제 업데이트
|
||||
|
|
@ -1478,23 +1478,22 @@ namespace Flow.Launcher.ViewModel
|
|||
break;
|
||||
}
|
||||
|
||||
if (Application.Current.MainWindow is MainWindow mainWindow2)
|
||||
{
|
||||
IntPtr hWnd = new WindowInteropHelper(mainWindow2).Handle;
|
||||
//if (Application.Current.MainWindow is MainWindow mainWindow2)
|
||||
//{
|
||||
// IntPtr hWnd = new WindowInteropHelper(mainWindow2).Handle;
|
||||
|
||||
// 📌 DWM Cloak 활성화
|
||||
int cloak = 1;
|
||||
DwmSetWindowAttribute(hWnd, DWMWA_CLOAK, ref cloak, sizeof(int));
|
||||
|
||||
// 📌 창을 완전히 숨김 (잔상 방지)
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
}
|
||||
// // 📌 Cloak을 사용하지 않고 일반적인 `ShowWindow(SW_HIDE)` 사용 → Mica/Acrylic 유지됨
|
||||
// ShowWindow(hWnd, SW_HIDE);
|
||||
//}
|
||||
|
||||
// WPF 속성 업데이트
|
||||
MainWindowVisibilityStatus = false;
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = false });
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if Flow Launcher should ignore any hotkeys
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue