Skip to content

Commit 46cdb2a

Browse files
committed
Fix Blink issue when hidestartup mode (hide on)
1 parent 2710de1 commit 46cdb2a

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public void RefreshFrame()
140140
if (mainWindowSrc == null)
141141
return;
142142

143+
143144
ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS();
144145
margins.cxLeftWidth = -1;
145146
margins.cxRightWidth = -1;
@@ -153,8 +154,7 @@ public void RefreshFrame()
153154
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
154155
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
155156

156-
// The timing of adding the shadow effect should vary depending on whether the theme is transparent.
157-
if (BlurEnabled)
157+
// The timing of adding the shadow effect should vary depending on whether the theme is transparent. if (BlurEnabled)
158158
{
159159
AutoDropShadow();
160160
}
@@ -164,6 +164,7 @@ public void RefreshFrame()
164164
{
165165
AutoDropShadow();
166166
}
167+
167168
}
168169

169170
public void AutoDropShadow()
@@ -248,16 +249,17 @@ public void SetBlurForWindow()
248249
var windowBorderStyle = dict["WindowBorderStyle"] as Style;
249250
if (windowBorderStyle == null)
250251
return;
252+
251253
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
252254
if (BlurEnabled)
253255
{
254256
//mainWindow.WindowStyle = WindowStyle.SingleBorderWindow;
255257
//BlurColor(BlurMode());
256258
Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~");
257259
Debug.WriteLine(BlurMode());
260+
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
258261
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
259262
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
260-
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
261263
//SetWindowCornerPreference("Round");
262264
}
263265
else

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,12 +815,23 @@ private void OnLocationChanged(object sender, EventArgs e)
815815
public void HideStartup()
816816
{
817817
UpdatePosition();
818+
818819
if (_settings.HideOnStartup)
819820
{
820-
_viewModel.Hide();
821+
// 📌 최초 실행 시 창이 깜빡이는 문제 방지 (완전히 숨긴 상태로 시작)
822+
System.Windows.Application.Current.MainWindow.Visibility = Visibility.Hidden;
823+
824+
Dispatcher.BeginInvoke((Action)(() =>
825+
{
826+
_viewModel.Hide();
827+
System.Windows.Application.Current.MainWindow.Visibility = Visibility.Collapsed;
828+
}), DispatcherPriority.Background);
821829
}
822830
else
823831
{
832+
// 📌 최초 실행 시 그림자 효과를 미리 적용하여 Show() 할 때 렌더링이 느려지지 않도록 함
833+
ThemeManager.Instance.SetBlurForWindow();
834+
//ThemeManager.Instance.AutoDropShadow();
824835
_viewModel.Show();
825836
}
826837
}

Flow.Launcher/Themes/Pink.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
99
<system:String x:Key="BlurMode">Light</system:String>
1010
<system:String x:Key="CornerType">RoundSmall</system:String>
11-
<Color x:Key="lightBG">#DDFEC7D7</Color>
12-
<Color x:Key="darkBG">#DDFEC7D7</Color>
11+
<Color x:Key="lightBG">#4BFEC7D7</Color>
12+
<Color x:Key="darkBG">#53FEC7D7</Color>
1313
<Thickness x:Key="ResultMargin">0 0 0 0</Thickness>
1414
<Style
1515
x:Key="ItemGlyph"
@@ -39,7 +39,7 @@
3939
BasedOn="{StaticResource BaseWindowBorderStyle}"
4040
TargetType="{x:Type Border}">
4141
<Setter Property="CornerRadius" Value="8" />
42-
<Setter Property="Background" Value="#fec7d7" />
42+
<Setter Property="Background" Value="Transparent" />
4343
<Setter Property="BorderThickness" Value="0" />
4444
<Setter Property="BorderBrush" Value="#0e172c" />
4545
</Style>

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,22 +1402,22 @@ public void Show()
14021402
{
14031403
IntPtr hWnd = new WindowInteropHelper(mainWindow).Handle;
14041404

1405-
// 📌 창을 먼저 보이게 설정
1406-
ShowWindow(hWnd, SW_SHOW);
1405+
// 📌 창을 보이도록 설정 (Cloak 사용 안 함)
1406+
//ShowWindow(hWnd, SW_SHOW);
1407+
1408+
// 📌 UI 요소 복원
14071409
mainWindow.ClockPanel.Visibility = Visibility.Visible;
14081410
mainWindow.SearchIcon.Visibility = Visibility.Visible;
1409-
// 📌 DWM Cloak 해제 (즉시 표시)
1410-
int cloak = 0;
1411-
DwmSetWindowAttribute(hWnd, DWMWA_CLOAK, ref cloak, sizeof(int));
14121411
}
14131412

14141413
// WPF 속성 업데이트
1415-
//MainWindowOpacity = 1;
1414+
MainWindowVisibility = Visibility.Visible;
14161415
MainWindowVisibilityStatus = true;
14171416
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true });
14181417
});
14191418
}
14201419

1420+
14211421
public async void Hide()
14221422
{
14231423
lastHistoryIndex = 1;
@@ -1432,7 +1432,7 @@ public async void Hide()
14321432

14331433
if (Application.Current.MainWindow is MainWindow mainWindow)
14341434
{
1435-
// 📌 아이콘과 시계 Opacity를 0으로 강제 설정하고 Visibility.Hidden 적용 (쿼리 상태와 관계없이 실행)
1435+
// 📌 아이콘과 시계 Opacity를 0으로 설정하고 Visibility.Hidden 적용
14361436
Application.Current.Dispatcher.Invoke(() =>
14371437
{
14381438
mainWindow.ClockPanel.Opacity = 0;
@@ -1445,7 +1445,7 @@ public async void Hide()
14451445
mainWindow.SearchIcon.UpdateLayout();
14461446
}, DispatcherPriority.Render);
14471447

1448-
await Task.Delay(10); // UI 반영 대기
1448+
//await Task.Delay(10); // UI 반영 대기
14491449
}
14501450

14511451
// 📌 텍스트 초기화 즉시 적용 + UI 강제 업데이트
@@ -1478,23 +1478,22 @@ public async void Hide()
14781478
break;
14791479
}
14801480

1481-
if (Application.Current.MainWindow is MainWindow mainWindow2)
1482-
{
1483-
IntPtr hWnd = new WindowInteropHelper(mainWindow2).Handle;
1481+
//if (Application.Current.MainWindow is MainWindow mainWindow2)
1482+
//{
1483+
// IntPtr hWnd = new WindowInteropHelper(mainWindow2).Handle;
14841484

1485-
// 📌 DWM Cloak 활성화
1486-
int cloak = 1;
1487-
DwmSetWindowAttribute(hWnd, DWMWA_CLOAK, ref cloak, sizeof(int));
1488-
1489-
// 📌 창을 완전히 숨김 (잔상 방지)
1490-
ShowWindow(hWnd, SW_HIDE);
1491-
}
1485+
// // 📌 Cloak을 사용하지 않고 일반적인 `ShowWindow(SW_HIDE)` 사용 → Mica/Acrylic 유지됨
1486+
// ShowWindow(hWnd, SW_HIDE);
1487+
//}
14921488

14931489
// WPF 속성 업데이트
14941490
MainWindowVisibilityStatus = false;
1491+
MainWindowVisibility = Visibility.Collapsed;
14951492
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = false });
14961493
}
14971494

1495+
1496+
14981497
/// <summary>
14991498
/// Checks if Flow Launcher should ignore any hotkeys
15001499
/// </summary>

0 commit comments

Comments
 (0)