Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@microsoft.com>2020-01-20 21:43:03 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2020-01-20 21:43:03 +0300
commit8eb56440b8e2cc396b1de1d1b868081021df8dea (patch)
treeb49c2032688557689184a75cd83b8424f8896d13
parent666a40983eeb6bc45d25a9bfcd071a338e28974c (diff)
[Ide] Delay InformationPopoverWidget popup hiding
When the TooltipPopoverWindow is visible, the parent might receive mouse in/out events rapidly, depending on the parenting status of the parent dialogs. This might be caused by some Gtk Loop issue. Delaying the hiding of the popup when the mouse leaves effectively workarounds the issue.
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/InformationPopoverWidget.cs52
1 files changed, 39 insertions, 13 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/InformationPopoverWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/InformationPopoverWidget.cs
index 3f033c6bf0..a1f4a5522d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/InformationPopoverWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/InformationPopoverWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Timers;
using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Tasks;
@@ -158,9 +159,10 @@ namespace MonoDevelop.Components
void ShowPopover ()
{
- if (popover != null)
- popover.Destroy ();
- popover = TooltipPopoverWindow.Create (!WorkaroundNestedDialogFlickering ());
+ if (hideTooltipTimer?.Enabled == true)
+ hideTooltipTimer.Stop ();
+ if (popover == null)
+ popover = TooltipPopoverWindow.Create (!WorkaroundNestedDialogFlickering ());
popover.ShowArrow = true;
if (markup)
popover.Markup = message;
@@ -172,41 +174,65 @@ namespace MonoDevelop.Components
void UpdatePopover ()
{
- if (popover != null)
+ if (popover?.Visible == true)
ShowPopover ();
}
protected override void OnLostFocus (EventArgs args)
{
base.OnLostFocus (args);
- DestroyPopover ();
+ HidePopover ();
}
protected override void OnMouseExited (EventArgs args)
{
base.OnMouseExited (args);
- DestroyPopover ();
+ HidePopover (true);
}
protected override void OnPreferredSizeChanged ()
{
base.OnPreferredSizeChanged ();
if (!Visible)
- DestroyPopover ();
+ HidePopover ();
}
- void DestroyPopover ()
+ Timer hideTooltipTimer;
+
+ void HidePopover (bool delayed = false)
{
- if (popover != null) {
- popover.Destroy ();
- popover = null;
+ if (delayed) {
+ // we delay hiding using a timer to avoid tooltip flickering in case of focus stealing
+ // due to weird toolkit behaviour.
+ if (hideTooltipTimer == null) {
+ hideTooltipTimer = new Timer (50) {
+ AutoReset = false,
+ SynchronizingObject = this,
+ };
+ hideTooltipTimer.Elapsed += (sender, e) => {
+ if (popover?.Visible == true)
+ popover.Hide ();
+ };
+ }
+ hideTooltipTimer.Start ();
+ } else {
+ if (hideTooltipTimer?.Enabled == true)
+ hideTooltipTimer.Stop ();
+ if (popover?.Visible == true)
+ popover.Hide ();
}
}
protected override void Dispose (bool disposing)
{
- if (disposing)
- DestroyPopover ();
+ if (disposing) {
+ hideTooltipTimer?.Dispose ();
+ if (popover?.Visible == true)
+ popover.Hide ();
+ popover?.Dispose ();
+ }
+ hideTooltipTimer = null;
+ popover = null;
base.Dispose (disposing);
}
}