mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
gtk-demo: Improve drag icon handling in dnd example
Make the opacity change only apply to the 'ghost' of the item, not the drag icon.
This commit is contained in:
parent
e54060bac2
commit
d2f979ffaf
@ -187,6 +187,12 @@ canvas_item_new (double x,
|
||||
return GTK_WIDGET (item);
|
||||
}
|
||||
|
||||
static GdkPaintable *
|
||||
canvas_item_get_drag_icon (CanvasItem *item)
|
||||
{
|
||||
return gtk_widget_paintable_new (item->label);
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
prepare (GtkDragSource *source,
|
||||
double x,
|
||||
@ -218,11 +224,11 @@ drag_begin (GtkDragSource *source,
|
||||
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);
|
||||
paintable = canvas_item_get_drag_icon (CANVAS_ITEM (item));
|
||||
gtk_drag_source_set_icon (source, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
|
||||
gtk_widget_set_opacity (item, 0.5);
|
||||
gtk_widget_set_opacity (item, 0.3);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user