13
0

Allow DnDTreeView drag w/o object reference

This commit is contained in:
Robin Gareus 2022-01-19 04:53:37 +01:00
parent d4b436b4c5
commit 62a098811c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -136,13 +136,15 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase
TreeView::on_drag_data_get (context, selection_data, info, time);
} else if (selection_data.get_target() == object_type) {
} else if (selection_data.get_target() == object_type && drag_data.data_column >= 0) {
/* return a pointer to this object, which allows
* the receiver to call on_drag_data_received()
*/
void *c = this;
selection_data.set (8, (guchar*)&c, sizeof(void*));
} else {
TreeView::on_drag_data_get (context, selection_data, info, time);
}
}
@ -178,7 +180,7 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase
void get_object_drag_data (std::list<DataType>& l, Gtk::TreeView** source) const {
if (drag_data.source == 0) {
if (drag_data.source == 0 || drag_data.data_column < 0) {
return;
}