Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RetroBar/Controls/NotifyBalloon.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Popup Name="BalloonPopup"
IsOpen="False"
Opened="BalloonPopup_Opened"
Style="{DynamicResource NotifyBalloonPopup}">
<ContentControl Style="{DynamicResource NotifyBalloon}"
MouseLeftButtonUp="ContentControl_MouseLeftButtonUp"
Expand Down
14 changes: 12 additions & 2 deletions RetroBar/Controls/NotifyBalloon.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using ManagedShell.Common.Helpers;
using ManagedShell.WindowsTray;
using RetroBar.Utilities;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Threading;

Expand Down Expand Up @@ -130,14 +132,14 @@ private void startTimer(int timeout)

_closeTimer = new DispatcherTimer
{
Interval = System.TimeSpan.FromMilliseconds(timeout)
Interval = TimeSpan.FromMilliseconds(timeout)
};

_closeTimer.Tick += CloseTimer_Tick;
_closeTimer.Start();
}

private void CloseTimer_Tick(object sender, System.EventArgs e)
private void CloseTimer_Tick(object sender, EventArgs e)
{
closeBalloon();
_balloonInfo.SetVisibility(BalloonVisibility.TimedOut);
Expand All @@ -156,5 +158,13 @@ private void ContentControl_MouseLeftButtonUp(object sender, System.Windows.Inpu
closeBalloon();
e.Handled = true;
}

private void BalloonPopup_Opened(object sender, EventArgs e)
{
IntPtr balloonHwnd = (PresentationSource.FromVisual(BalloonPopup.Child) as HwndSource).Handle;
IntPtr taskbarHwnd = (PresentationSource.FromVisual(this) as HwndSource).Handle;

ManagedShell.Interop.NativeMethods.SetWindowLongPtr(balloonHwnd, ManagedShell.Interop.NativeMethods.WindowLongFlags.GWLP_HWNDPARENT, taskbarHwnd);
}
}
}