Skip to content

Commit

Permalink
Reset focus upon deactivation, update ManagedShell
Browse files Browse the repository at this point in the history
  • Loading branch information
dremin committed Nov 11, 2023
1 parent 68aa7ed commit c85ae4f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RetroBar/RetroBar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<ItemGroup>
<PackageReference Include="gong-wpf-dragdrop" Version="3.1.1" />
<PackageReference Include="ManagedShell" Version="0.0.225" />
<PackageReference Include="ManagedShell" Version="0.0.231" />
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions RetroBar/Taskbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
LocationChanged="Taskbar_OnLocationChanged"
SizeChanged="Taskbar_OnSizeChanged"
MouseLeftButtonDown="Taskbar_OnMouseLeftButtonDown"
Deactivated="Taskbar_Deactivated"
AllowDrop="True"
Style="{DynamicResource TaskbarWindow}">
<Window.Resources>
Expand Down
13 changes: 12 additions & 1 deletion RetroBar/Taskbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ private void Taskbar_OnSizeChanged(object sender, SizeChangedEventArgs e)
StartButton?.UpdateFloatingStartCoordinates();
}

private void Taskbar_Deactivated(object sender, EventArgs e)
{
// Prevent focus indicators and tooltips while not the active window
ResetControlFocus();
}

private void DateTimeMenuItem_OnClick(object sender, RoutedEventArgs e)
{
ShellHelper.StartProcess("timedate.cpl");
Expand Down Expand Up @@ -334,6 +340,11 @@ private void ExitMenuItem_OnClick(object sender, RoutedEventArgs e)
}
}

private void ResetControlFocus()
{
FocusDummyButton.MoveFocus(new TraversalRequest(FocusNavigationDirection.Left));
}

protected override bool ShouldAllowAutoHide()
{
return (!_startMenuOpen || !Screen.Primary) && base.ShouldAllowAutoHide();
Expand Down Expand Up @@ -376,7 +387,7 @@ protected override void OnAutoHideAnimationBegin(bool isHiding)
base.OnAutoHideAnimationBegin(isHiding);

// Prevent focus indicators and tooltips while hidden
FocusDummyButton.MoveFocus(new TraversalRequest(FocusNavigationDirection.Left));
ResetControlFocus();
}

private void ContextMenu_Opened(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit c85ae4f

Please sign in to comment.