mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Code cleanup
This commit is contained in:
parent
8b10973dda
commit
1ca17aa2db
3 changed files with 21 additions and 22 deletions
|
|
@ -16,7 +16,21 @@ namespace Flow.Launcher.Infrastructure
|
|||
{
|
||||
// Windows 11 (22000) 이상에서만 Mica 및 Acrylic 효과 지원
|
||||
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
||||
Environment.OSVersion.Version.Build >= 22000;
|
||||
Environment.OSVersion.Version.Build >= 22000;
|
||||
}
|
||||
|
||||
public static unsafe bool DWMSetCloakForWindow(Window window, bool cloak)
|
||||
{
|
||||
var windowHelper = new WindowInteropHelper(window);
|
||||
windowHelper.EnsureHandle();
|
||||
|
||||
var cloaked = cloak ? 1 : 0;
|
||||
|
||||
return PInvoke.DwmSetWindowAttribute(
|
||||
new(windowHelper.Handle),
|
||||
DWMWINDOWATTRIBUTE.DWMWA_CLOAK,
|
||||
&cloaked,
|
||||
(uint)Marshal.SizeOf<int>()).Succeeded;
|
||||
}
|
||||
|
||||
public static unsafe bool DWMSetBackdropForWindow(Window window, BackdropTypes backdrop)
|
||||
|
|
|
|||
|
|
@ -186,12 +186,11 @@ namespace Flow.Launcher
|
|||
InitializeColorScheme();
|
||||
WindowsInteropHelper.DisableControlBox(this);
|
||||
InitProgressbarAnimation();
|
||||
// Move the window out of screen because setting backdrop will cause flicker with a rectangle
|
||||
Left = Top = -10000;
|
||||
await ThemeManager.Instance.RefreshFrameAsync();
|
||||
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
|
||||
InitializePosition();
|
||||
InitializePosition();
|
||||
// Refresh frame
|
||||
await ThemeManager.Instance.RefreshFrameAsync();
|
||||
PreviewReset();
|
||||
// Since the default main window visibility is visible, so we need set focus during startup
|
||||
QueryTextBox.Focus();
|
||||
|
|
@ -825,26 +824,13 @@ namespace Flow.Launcher
|
|||
|
||||
public void HideStartup()
|
||||
{
|
||||
//_viewModel.MainWindowOpacity = 0.2; /*Fix Render Blinking */
|
||||
if (_settings.HideOnStartup)
|
||||
{
|
||||
// 📌 최초 실행 시 창이 깜빡이는 문제 방지 (완전히 숨긴 상태로 시작)
|
||||
//System.Windows.Application.Current.MainWindow.Visibility = Visibility.Hidden;
|
||||
|
||||
//Dispatcher.BeginInvoke((Action)(() =>
|
||||
//{
|
||||
// _viewModel.Hide();
|
||||
// System.Windows.Application.Current.MainWindow.Visibility = Visibility.Collapsed;
|
||||
//}), DispatcherPriority.Background);
|
||||
_viewModel.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 📌 최초 실행 시 그림자 효과를 미리 적용하여 Show() 할 때 렌더링이 느려지지 않도록 함
|
||||
//ThemeManager.Instance.SetBlurForWindow();
|
||||
//ThemeManager.Instance.AutoDropShadow();
|
||||
_viewModel.Show();
|
||||
//_viewModel.MainWindowOpacity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1386,10 +1386,8 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||
{
|
||||
IntPtr hWnd = new WindowInteropHelper(mainWindow).Handle;
|
||||
|
||||
// 📌 창을 보이도록 설정 (Cloak 사용 안 함)
|
||||
//ShowWindow(hWnd, SW_SHOW);
|
||||
// 📌 DWM Cloak 해제 (창을 정상적으로 표시)
|
||||
Win32Helper.DWMSetCloakForWindow(mainWindow, false);
|
||||
|
||||
// 📌 UI 요소 복원
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Visible;
|
||||
|
|
@ -1433,7 +1431,8 @@ namespace Flow.Launcher.ViewModel
|
|||
mainWindow.SearchIcon.UpdateLayout();
|
||||
}, DispatcherPriority.Render);
|
||||
|
||||
//await Task.Delay(10); // UI 반영 대기
|
||||
// 📌 DWM Cloak 적용 (창을 완전히 숨김)
|
||||
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
|
||||
}
|
||||
|
||||
// 📌 텍스트 초기화 즉시 적용 + UI 강제 업데이트
|
||||
|
|
|
|||
Loading…
Reference in a new issue