minor peak-meter performance tweak
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / dndtreeview.h
index 5464920a59b89d6bea716d1f617d00af7cd492d7..b5f18fa8902c7545d05c057898a07821dcf105e6 100644 (file)
@@ -70,6 +70,8 @@ class DnDTreeViewBase : public Gtk::TreeView
        std::string                 object_type;
 
        struct DragData {
+           DragData () : source (0) {}
+               
            Gtk::TreeView* source;
            int            data_column;
            std::string    object_type;
@@ -91,7 +93,7 @@ class DnDTreeView : public DnDTreeViewBase
        DnDTreeView() {} 
        ~DnDTreeView() {}
 
-       sigc::signal<void,const std::list<DataType>&,Gtk::TreeView*,Glib::RefPtr<Gdk::DragContext>&> signal_drop;
+       sigc::signal<void,const std::list<DataType>&,Gtk::TreeView*,int,int,Glib::RefPtr<Gdk::DragContext>&> signal_drop;
 
        void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time) {
                if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") {
@@ -126,7 +128,7 @@ class DnDTreeView : public DnDTreeViewBase
 
                } else if (selection_data.get_target() == object_type) {
                        
-                       end_object_drag (const_cast<Glib::RefPtr<Gdk::DragContext>& > (context));
+                       end_object_drag (const_cast<Glib::RefPtr<Gdk::DragContext>& > (context), x, y);
 
                } else {
                        /* some kind of target type added by the app, which will be handled by a signal handler */
@@ -134,11 +136,16 @@ class DnDTreeView : public DnDTreeViewBase
        }
 
        /**
-        * this can be called by the Treeview itself or by some other
+        * This can be called by the Treeview itself or by some other
         * object that wants to get the list of dragged items.
         */
 
        void get_object_drag_data (std::list<DataType>& l, Gtk::TreeView** source) {
+
+               if (drag_data.source == 0) {
+                       return;
+               }
+                       
                Glib::RefPtr<Gtk::TreeModel> model = drag_data.source->get_model();
                DataType v;
                Gtk::TreeSelection::ListHandle_Path selection = drag_data.source->get_selection()->get_selected_rows ();
@@ -152,11 +159,11 @@ class DnDTreeView : public DnDTreeViewBase
        }
 
   private:
-       void end_object_drag (Glib::RefPtr<Gdk::DragContext>& context) {
+       void end_object_drag (Glib::RefPtr<Gdk::DragContext>& context, int x, int y) {
                std::list<DataType> l;
                Gtk::TreeView* source;
                get_object_drag_data (l, &source);
-               signal_drop (l, source, context);
+               signal_drop (l, source, x, y, context);
        }
 
 };