Skip to content

Commit 5a052ed

Browse files
committed
Harden start menu handover
1 parent 05ff6eb commit 5a052ed

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

EverythingToolbar/SearchWindow.xaml.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Windows;
33
using System.Windows.Input;
44
using System.Windows.Interop;
@@ -27,6 +27,7 @@ public partial class SearchWindow
2727
public event EventHandler<ShowingEventArgs>? Showing;
2828

2929
private bool _isFirstShow = true;
30+
private bool _isHiding;
3031
private readonly SearchWindowViewModel _viewModel;
3132
private readonly SearchWindowController _controller;
3233
private readonly SearchWindowAnimator _animator;
@@ -83,14 +84,16 @@ private void OpenSearchInEverything(object? sender, RoutedEventArgs e)
8384

8485
internal void Show(ShowOptions options)
8586
{
86-
if (Visibility == Visibility.Visible)
87+
if (Visibility == Visibility.Visible && !_isHiding)
8788
{
8889
if (options.Activate)
8990
ActivateAndBringToFront();
9091

9192
return;
9293
}
9394

95+
_isHiding = false;
96+
9497
if (_isFirstShow)
9598
PreWarm();
9699

@@ -107,9 +110,10 @@ internal void Show(ShowOptions options)
107110

108111
internal void HideAnimated()
109112
{
110-
if (Visibility != Visibility.Visible)
113+
if (Visibility != Visibility.Visible || _isHiding)
111114
return;
112115

116+
_isHiding = true;
113117
Hiding?.Invoke(this, EventArgs.Empty);
114118
}
115119

@@ -120,6 +124,7 @@ internal void FocusSearchBox()
120124

121125
private void OnHidden()
122126
{
127+
_isHiding = false;
123128
_viewModel.SavePopupSize((int)Width, (int)Height);
124129

125130
// Push outside of screens to hide Windows' closing animation

EverythingToolbar/Services/StartMenuSearchInterceptor.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,10 @@ private void TriggerSearchWindow()
241241
private void ShowSearchUiForReplay()
242242
{
243243
if (_windowsPolicy.IsTaskbarWindowActive())
244-
{
245244
_controller.ShowStandalone();
246-
return;
247-
}
245+
else
246+
_controller.Show();
248247

249-
_controller.Show();
250248
_controller.FocusSearchBox();
251249
}
252250

@@ -321,7 +319,6 @@ private void RestoreAnimations()
321319

322320
private void HookStartMenuInput()
323321
{
324-
UnhookStartMenuInput();
325322
_keyboardHook.Install();
326323
}
327324

0 commit comments

Comments
 (0)