mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2697 from onesounds/240516BlockHoverWhenKeyboardUsing
Block Mouse Hover event when Show / Keyboard Navigation
This commit is contained in:
commit
b9b3422aac
2 changed files with 23 additions and 1 deletions
|
|
@ -25,6 +25,7 @@
|
|||
LocationChanged="OnLocationChanged"
|
||||
Opacity="{Binding MainWindowOpacity, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
PreviewKeyDown="OnKeyDown"
|
||||
PreviewKeyUp="OnKeyUp"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
SizeToContent="Height"
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ namespace Flow.Launcher
|
|||
private MainViewModel _viewModel;
|
||||
private bool _animating;
|
||||
MediaPlayer animationSound = new MediaPlayer();
|
||||
private bool isArrowKeyPressed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -109,9 +110,11 @@ namespace Flow.Launcher
|
|||
private void OnInitialized(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs _)
|
||||
{
|
||||
// MouseEventHandler
|
||||
PreviewMouseMove += MainPreviewMouseMove;
|
||||
|
||||
CheckFirstLaunch();
|
||||
HideStartup();
|
||||
// show notify icon when flowlauncher is hidden
|
||||
|
|
@ -406,6 +409,7 @@ namespace Flow.Launcher
|
|||
if (_animating)
|
||||
return;
|
||||
|
||||
isArrowKeyPressed = true;
|
||||
_animating = true;
|
||||
UpdatePosition();
|
||||
|
||||
|
|
@ -494,6 +498,7 @@ namespace Flow.Launcher
|
|||
windowsb.Completed += (_, _) => _animating = false;
|
||||
_settings.WindowLeft = Left;
|
||||
_settings.WindowTop = Top;
|
||||
isArrowKeyPressed = false;
|
||||
|
||||
if (QueryTextBox.Text.Length == 0)
|
||||
{
|
||||
|
|
@ -644,10 +649,12 @@ namespace Flow.Launcher
|
|||
switch (e.Key)
|
||||
{
|
||||
case Key.Down:
|
||||
isArrowKeyPressed = true;
|
||||
_viewModel.SelectNextItemCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Key.Up:
|
||||
isArrowKeyPressed = true;
|
||||
_viewModel.SelectPrevItemCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
break;
|
||||
|
|
@ -698,7 +705,21 @@ namespace Flow.Launcher
|
|||
|
||||
}
|
||||
}
|
||||
private void OnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Up || e.Key == Key.Down)
|
||||
{
|
||||
isArrowKeyPressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MainPreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
{
|
||||
if (isArrowKeyPressed)
|
||||
{
|
||||
e.Handled = true; // Ignore Mouse Hover when press Arrowkeys
|
||||
}
|
||||
}
|
||||
public void PreviewReset()
|
||||
{
|
||||
_viewModel.ResetPreview();
|
||||
|
|
|
|||
Loading…
Reference in a new issue