gtk-demo: Use proper drag icons in the dnd demo

Use a widget paintable to make the drag icon appear
in two places at once.
This commit is contained in:
Matthias Clasen 2020-05-22 10:50:09 -04:00
parent 78b427c99d
commit 028bccc188

View File

@ -32,10 +32,15 @@ drag_begin (GtkDragSource *source,
{
GtkWidget *canvas;
GtkWidget *item;
GdkPaintable *paintable;
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = g_object_get_data (G_OBJECT (canvas), "dragged-item");
paintable = gtk_widget_paintable_new (item);
gtk_drag_source_set_icon (source, paintable, 0, 0);
g_object_unref (paintable);
gtk_widget_set_opacity (item, 0.5);
}