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
committermonojenkins <jo.shields+jenkins@xamarin.com>2020-01-21 10:42:15 +0300
commit1adb065235353ec361dcdd4010aa5958a3645efc (patch)
tree4322ef4c0ae5736b6a41083d9270779a5446e9af
parenteb6fcdd83a227678e487aa733df3c8745f54fafc (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);
}
}