[mono/monodevelop] 037e6809: Fixed 'Bug 15140 - Placing the cursor over an error/warning bubble

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014182103f5c-b7e9165f-bf57-4b95-9a85-579e9d57ca00-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/66ed1a690fc4...037e68094d0e

   Commit: 037e68094d0e746b2dad1dea6922a610e329b372
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-04 06:02:11 GMT
      URL: https://github.com/mono/monodevelop/commit/037e68094d0e746b2dad1dea6922a610e329b372

Fixed 'Bug 15140 - Placing the cursor over an error/warning bubble
popover should prevent it from closing.'

Changed paths:
  M main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs

Modified: main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs
===================================================================
@@ -30,6 +30,8 @@
 using MonoDevelop.Ide.Fonts;
 using Mono.TextEditor.Highlighting;
 using MonoDevelop.Components;
+using Cairo;
+using MonoDevelop.Ide.Gui.Components;
 
 namespace MonoDevelop.SourceEditor
 {
@@ -140,7 +142,7 @@ protected override void OnSizeRequested (ref Gtk.Requisition requisition)
 
 			protected override bool OnEnterNotifyEvent (Gdk.EventCrossing evnt)
 			{
-				cache.DestroyPopoverWindow ();
+				cache.CancelLeaveDestroyTimeout ();
 				return base.OnEnterNotifyEvent (evnt);
 			}
 
@@ -235,9 +237,25 @@ void HandleBeginHover (object sender, EventArgs e)
 			editor.QueueDraw ();
 		}
 
+		uint leaveDestroyTimeout;
+
+		void CancelLeaveDestroyTimeout ()
+		{
+			if (leaveDestroyTimeout != 0) {
+				GLib.Source.Remove (leaveDestroyTimeout);
+				leaveDestroyTimeout = 0;
+			}
+		}
+
 		void HandleLeaveNotifyEvent (object o, Gtk.LeaveNotifyEventArgs args)
 		{
-			DestroyPopoverWindow ();
+			CancelLeaveDestroyTimeout ();
+			leaveDestroyTimeout = GLib.Timeout.Add (100, delegate {
+				DestroyPopoverWindow ();
+				leaveDestroyTimeout = 0;
+				return false;
+			}); 
+
 			CancelHoverTimeout ();
 			if (CurrentSelectedTextMarker == null)
 				return;
@@ -263,6 +281,7 @@ internal void DestroyPopoverWindow ()
 
 		public void Dispose ()
 		{
+			CancelLeaveDestroyTimeout ();
 			CancelHoverTimeout ();
 			DestroyPopoverWindow ();
 			editor.VAdjustment.ValueChanged -= HandleValueChanged;
@@ -331,4 +350,3 @@ protected virtual void OnChanged (EventArgs e)
 		public event EventHandler Changed;
 	}
 }
-
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.