Skip to content

Commit 89e03d6

Browse files
committed
Remove Cachemode
1 parent 350276d commit 89e03d6

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private void OnSourceInitialized(object sender, EventArgs e)
9696
Win32Helper.HideFromAltTab(this);
9797
Win32Helper.DisableControlBox(this);
9898
}
99-
99+
100100
private async void OnLoaded(object sender, RoutedEventArgs _)
101101
{
102102
// Check first launch
@@ -236,6 +236,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
236236
DependencyPropertyDescriptor
237237
.FromProperty(VisibilityProperty, typeof(StackPanel)) // History는 StackPanel이라고 가정
238238
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
239+
_viewModel.ClearAllCacheModes(this);
239240
}
240241

241242
private async void OnClosing(object sender, CancelEventArgs e)

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ private void OnLoaded(object sender, RoutedEventArgs e)
3636
RefreshMaximizeRestoreButton();
3737
// Fix (workaround) for the window freezes after lock screen (Win+L) or sleep
3838
// https://stackoverflow.com/questions/4951058/software-rendering-mode-wpf
39-
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
40-
HwndTarget hwndTarget = hwndSource.CompositionTarget;
41-
hwndTarget.RenderMode = RenderMode.SoftwareOnly; // Must use software only render mode here
39+
//HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
40+
//HwndTarget hwndTarget = hwndSource.CompositionTarget;
41+
//hwndTarget.RenderMode = RenderMode.SoftwareOnly; // Must use software only render mode here
4242

4343
InitializePosition();
4444
}

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4+
using System.Diagnostics;
45
using System.Globalization;
56
using System.Windows.Input;
67
using System.Linq;
@@ -1428,7 +1429,36 @@ public bool ShouldIgnoreHotkeys()
14281429
#endregion
14291430

14301431
#region Public Methods
1432+
public void ClearAllCacheModes(DependencyObject element)
1433+
{
1434+
if (element == null)
1435+
return;
14311436

1437+
// 현재 요소의 CacheMode를 확인하고 제거
1438+
if (element is UIElement uiElement && uiElement.CacheMode != null)
1439+
{
1440+
string elementName = GetElementName(uiElement);
1441+
Debug.WriteLine($"CacheMode 제거: {elementName} - CacheMode 타입: {uiElement.CacheMode.GetType().Name}");
1442+
uiElement.CacheMode = null;
1443+
}
1444+
1445+
// 모든 자식 요소에 대해 재귀적으로 CacheMode 제거
1446+
int childCount = VisualTreeHelper.GetChildrenCount(element);
1447+
for (int i = 0; i < childCount; i++)
1448+
{
1449+
DependencyObject child = VisualTreeHelper.GetChild(element, i);
1450+
ClearAllCacheModes(child);
1451+
}
1452+
}
1453+
private string GetElementName(UIElement element)
1454+
{
1455+
// 요소의 이름 가져오기 시도
1456+
if (element is FrameworkElement fe && !string.IsNullOrEmpty(fe.Name))
1457+
return fe.Name;
1458+
1459+
// 이름이 없으면 타입 반환
1460+
return element.GetType().Name;
1461+
}
14321462
public void Show()
14331463
{
14341464
Application.Current.Dispatcher.Invoke(() =>
@@ -1442,6 +1472,7 @@ public void Show()
14421472
mainWindow.ClockPanel.Visibility = Visibility.Visible;
14431473
//mainWindow.SearchIcon.Visibility = Visibility.Visible;
14441474
SearchIconVisibility = Visibility.Visible;
1475+
ClearAllCacheModes(mainWindow);
14451476
}
14461477

14471478
// Update WPF properties
@@ -1454,8 +1485,11 @@ public void Show()
14541485
{
14551486
Win32Helper.SwitchToEnglishKeyboardLayout(true);
14561487
}
1488+
14571489
});
14581490
}
1491+
1492+
14591493

14601494
#pragma warning disable VSTHRD100 // Avoid async void methods
14611495

0 commit comments

Comments
 (0)