[tomboy] Fix middle-click pasting of links



commit 5fd95754234657b086b5f8b13c546980d0872b87
Author: Stefan Schweizer <steve schweizer gmail com>
Date:   Wed May 13 11:04:09 2009 +0200

    Fix middle-click pasting of links
    
    Prevent activation of links that have just been middle-click pasted to a
    note. Closes: bgo#414029.
---
 Tomboy/NoteTag.cs |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/Tomboy/NoteTag.cs b/Tomboy/NoteTag.cs
index f74b643..464fac1 100644
--- a/Tomboy/NoteTag.cs
+++ b/Tomboy/NoteTag.cs
@@ -17,6 +17,7 @@ namespace Tomboy
 		string element_name;
 		Gtk.TextMark widgetLocation;
 		Gtk.Widget widget;
+		bool allow_middle_activate = false;
 
 		[Flags]
 		enum TagFlags {
@@ -200,8 +201,10 @@ namespace Tomboy
 
 				// Do not insert selected text when activating links with
 				// middle mouse button
-				if (button_ev.Button == 2)
+				if (button_ev.Button == 2) {
+					allow_middle_activate = true;
 					return true;
+				}
 
 				return false;
 
@@ -220,6 +223,13 @@ namespace Tomboy
 				if (editor.Buffer.HasSelection)
 					return false;
 
+				// Don't activate if the link has just been pasted with the
+				// middle mouse button (no preceding ButtonPress event)
+				if (button_ev.Button == 2 && !allow_middle_activate)
+					return false;
+				else
+					allow_middle_activate = false;
+
 				GetExtents (iter, out start, out end);
 				bool success = OnActivate (editor, start, end);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]