diff --git a/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h b/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h index 083fee6378..bf84a17f5e 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h @@ -104,12 +104,11 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase } else if (selection_data.get_target() == object_type) { - /* we don't care about the data passed around by DnD, but - we have to provide something otherwise it will stop. + /* return a pointer to this object, which allows + * the receiver to call on_drag_data_received() */ - - guchar c; - selection_data.set (8, (guchar*)&c, 1); + void *c = this; + selection_data.set (8, (guchar*)&c, sizeof(void*)); } } @@ -142,7 +141,7 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase * object that wants to get the list of dragged items. */ - void get_object_drag_data (std::list& l, Gtk::TreeView** source) { + void get_object_drag_data (std::list& l, Gtk::TreeView** source) const { if (drag_data.source == 0) { return; diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index 84289aff34..12e63c1c7f 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -51,9 +51,13 @@ template class /*LIBGTKMM2EXT_API*/ DnDVBox : public Gtk::EventBox { public: - DnDVBox () : _active (0), _drag_icon (0), _expecting_unwanted_button_event (false), _placeholder (0) + DnDVBox (std::list targets) + : _targets (targets) + , _active (0) + , _drag_icon (0) + , _expecting_unwanted_button_event (false) + , _placeholder (0) { - _targets.push_back (Gtk::TargetEntry ("processor")); add (_internal_vbox); add_events ( @@ -220,6 +224,7 @@ public: * Parameters are the source DnDVBox, our child which the other one was dropped on (or 0) and the DragContext. */ sigc::signal const & > DropFromAnotherBox; + sigc::signal const & > DropFromExternal; sigc::signal SelectionChanged; private: @@ -352,6 +357,12 @@ private: /* work out where it was dropped */ std::pair const drop = get_child_at_position (y); + if (selection_data.get_target () != _targets.front ().get_target ()) { + DropFromExternal (selection_data, drop.first, context); + context->drag_finish (false, false, time); + return; + } + if (_drag_source == this) { /* dropped from ourselves onto ourselves */