Skip to content

Commit d189bac

Browse files
committed
Remove window shown check
1 parent 0583dff commit d189bac

File tree

1 file changed

+9
-33
lines changed

1 file changed

+9
-33
lines changed

Flow.Launcher.Infrastructure/QuickSwitch/QuickSwitch.cs

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ public static class QuickSwitch
5555

5656
private static DispatcherTimer _dragMoveTimer = null;
5757

58-
// A list of all file dialog windows that are shown quick switch window already
59-
private static readonly List<HWND> _shownQuickSwitchWindowDialogs = new();
60-
61-
private static readonly object _shownQuickSwitchWindowDialogsLock = new();
62-
6358
// A list of all file dialog windows that are auto switched already
6459
private static readonly List<HWND> _autoSwitchedDialogs = new();
6560

@@ -175,17 +170,10 @@ public static void Initialize()
175170

176171
#region Invoke Property Events
177172

178-
private static void InvokeShowQuickSwitchWindow(HWND hwnd)
173+
private static void InvokeShowQuickSwitchWindow()
179174
{
180-
// Check if the quick switch window is already shown for this dialog
181-
bool alreadyShown;
182-
lock (_shownQuickSwitchWindowDialogsLock)
183-
{
184-
alreadyShown = _shownQuickSwitchWindowDialogs.Contains(hwnd);
185-
}
186-
187175
// Show quick switch window
188-
if (_settings.ShowQuickSwitchWindow && !alreadyShown)
176+
if (_settings.ShowQuickSwitchWindow)
189177
{
190178
ShowQuickSwitchWindow?.Invoke(_dialogWindowHandle.Value);
191179
_dragMoveTimer?.Start();
@@ -198,27 +186,15 @@ private static void InvokeUpdateQuickSwitchWindow()
198186
UpdateQuickSwitchWindow?.Invoke();
199187
}
200188

201-
private static void InvokeResetQuickSwitchWindow(HWND hwnd)
189+
private static void InvokeResetQuickSwitchWindow()
202190
{
203-
// Remove the dialog from the list of shown quick switch windows
204-
lock (_shownQuickSwitchWindowDialogsLock)
205-
{
206-
_shownQuickSwitchWindowDialogs.Remove(hwnd);
207-
}
208-
209191
// Reset quick switch window
210192
ResetQuickSwitchWindow?.Invoke();
211193
_dragMoveTimer?.Stop();
212194
}
213195

214-
private static void InvokeHideQuickSwitchWindow(HWND hwnd)
196+
private static void InvokeHideQuickSwitchWindow()
215197
{
216-
// Remove the dialog from the list of shown quick switch windows
217-
lock (_shownQuickSwitchWindowDialogsLock)
218-
{
219-
_shownQuickSwitchWindowDialogs.Remove(hwnd);
220-
}
221-
222198
// Neither quick switch window nor file dialog window is foreground
223199
// Hide quick switch window until the file dialog window is brought to the foreground
224200
HideQuickSwitchWindow?.Invoke();
@@ -274,20 +250,20 @@ uint dwmsEventTime
274250
// Just show quick switch window
275251
if (alreadySwitched)
276252
{
277-
InvokeShowQuickSwitchWindow(hwnd);
253+
InvokeShowQuickSwitchWindow();
278254
}
279255
// Show quick switch window after navigating the path
280256
else
281257
{
282258
NavigateDialogPath(hwnd, () =>
283259
{
284-
InvokeShowQuickSwitchWindow(hwnd);
260+
InvokeShowQuickSwitchWindow();
285261
});
286262
}
287263
}
288264
else
289265
{
290-
InvokeShowQuickSwitchWindow(hwnd);
266+
InvokeShowQuickSwitchWindow();
291267
}
292268
}
293269
// Quick switch window
@@ -300,7 +276,7 @@ uint dwmsEventTime
300276
{
301277
if (_dialogWindowHandle != HWND.Null)
302278
{
303-
InvokeHideQuickSwitchWindow(_dialogWindowHandle);
279+
InvokeHideQuickSwitchWindow();
304280
}
305281

306282
// Check if explorer window is foreground
@@ -406,7 +382,7 @@ uint dwmsEventTime
406382
{
407383
_autoSwitchedDialogs.Remove(hwnd);
408384
}
409-
InvokeResetQuickSwitchWindow(hwnd);
385+
InvokeResetQuickSwitchWindow();
410386
}
411387
}
412388

0 commit comments

Comments
 (0)