Skip to content

Commit

Permalink
Update tray tooltip more consistently (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tester798 authored Aug 9, 2023
1 parent 2aaad73 commit 5b0c7f0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions EarTrumpet/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,23 @@ private void CompleteStartup()
DisplayFirstRunExperience();
}

private void UpdateTrayTooltip()
{
_trayIcon.SetTooltip(CollectionViewModel.GetTrayToolTip());

var hWndTray = WindowsTaskbar.GetTrayToolbarWindowHwnd();
var hWndTooltip = User32.SendMessage(hWndTray, User32.TB_GETTOOLTIPS, IntPtr.Zero, IntPtr.Zero);
User32.SendMessage(hWndTooltip, User32.TTM_POPUP, IntPtr.Zero, IntPtr.Zero);
}

private void trayIconScrolled(object _, int wheelDelta)
{
if (Settings.UseScrollWheelInTray && (!Settings.UseGlobalMouseWheelHook || _flyoutViewModel.State == FlyoutViewState.Hidden))
{
var hWndTray = WindowsTaskbar.GetTrayToolbarWindowHwnd();
var hWndTooltip = User32.SendMessage(hWndTray, User32.TB_GETTOOLTIPS, IntPtr.Zero, IntPtr.Zero);
User32.SendMessage(hWndTooltip, User32.TTM_POPUP, IntPtr.Zero, IntPtr.Zero);

CollectionViewModel.Default?.IncrementVolume(Math.Sign(wheelDelta) * 2);
}

UpdateTrayTooltip();
}

private void DisplayFirstRunExperience()
Expand Down

0 comments on commit 5b0c7f0

Please sign in to comment.