[gnote] Allow drag and select within links by activating only with button release. (Tomboy bug #414029).



commit 58ceac6859b28fdecb092951fcb653f31ad8e3a4
Author: Hubert Figuiere <hub figuiere net>
Date:   Thu Jul 16 23:44:33 2009 -0400

    Allow drag and select within links by activating only with button release. (Tomboy bug #414029).
    (tb-backport)

 src/notetag.cpp |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/notetag.cpp b/src/notetag.cpp
index e929a51..5fba580 100644
--- a/src/notetag.cpp
+++ b/src/notetag.cpp
@@ -171,6 +171,17 @@ namespace gnote {
     {
       GdkEventButton *button_ev = (GdkEventButton*)ev;
 
+      // Do not insert selected text when activating links with
+      // middle mouse button
+      if (button_ev->button == 2) {
+        return true;
+      }
+
+      return false;
+    }
+    case GDK_BUTTON_RELEASE:
+    {
+      GdkEventButton *button_ev = (GdkEventButton*)ev;
       if ((button_ev->button != 1) && (button_ev->button != 2))
         return false;
 
@@ -179,15 +190,21 @@ namespace gnote {
                                Gdk::CONTROL_MASK)) != 0)
         return false;
 
+      // Prevent activation when selecting links with the mouse
+      if (editor->get_buffer()->get_has_selection()) {
+        return false;
+      }
+
       get_extents (iter, start, end);
       bool success = on_activate (*(editor.operator->()), start, end);
 
+      // Hide note if link is activated with middle mouse button
       if (success && (button_ev->button == 2)) {
         Glib::RefPtr<Gtk::Widget> widget = Glib::RefPtr<Gtk::Widget>::cast_static(sender);
         widget->get_toplevel()->hide ();
       }
 
-      return success;
+      return false;
     }
     case GDK_KEY_PRESS:
     {



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