port: add the dragged port as the drag icon

This makes it the port label follows your cursor around instead of the generic
text document icon that doesn't make a lot of sense here.
This commit is contained in:
Carlos Martín Nieto
2023-03-14 19:52:54 +01:00
parent 69257ffa09
commit 84570f44bf

View File

@@ -158,9 +158,11 @@ impl Port {
Direction::Output => ForwardLink(id).to_value(),
}))
.build();
drag_src.connect_drag_begin(move |_, _| {
drag_src.connect_drag_begin(clone!(@weak res as obj => move |source, _| {
trace!("Drag started from port {}", id);
});
let paintable = gtk::WidgetPaintable::new(Some(&obj));
source.set_icon(Some(&paintable), 0, 0);
}));
drag_src.connect_drag_cancel(move |_, _, _| {
trace!("Drag from port {} was cancelled", id);
false