diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-10-23 14:16:31 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-10-23 14:16:31 +0200 |
commit | 493f5d6b1856229196ccc70362e35376bae085a6 (patch) | |
tree | 44e5d5399493c26dc2479da915889deaa19deffd /gtk/gtkdragsource.c | |
parent | d3fc937b4ddad6462bfca6402ce0a186f98d4908 (diff) | |
download | gtk+-493f5d6b1856229196ccc70362e35376bae085a6.tar.gz |
dnd: Add more surface apis
The new function, gtk_drag_source_set_icon_surface, is for setting
a drag source icon without using GdkPixbuf.
Diffstat (limited to 'gtk/gtkdragsource.c')
-rw-r--r-- | gtk/gtkdragsource.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c index e6bc185797..4c701b4599 100644 --- a/gtk/gtkdragsource.c +++ b/gtk/gtkdragsource.c @@ -374,6 +374,32 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget, } /** + * gtk_drag_source_set_icon_surface: (method) + * @widget: a #GtkWidget + * @surface: the cairo surface for the drag icon + * + * Sets the icon that will be used for drags from a particular widget + * from a cairo surface. GTK+ retains a reference for @surface and will + * release it when it is no longer needed. + * + * Since: 3.94 + */ +void +gtk_drag_source_set_icon_surface (GtkWidget *widget, + cairo_surface_t *surface) +{ + GtkDragSourceSite *site; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + site = g_object_get_data (G_OBJECT (widget), "gtk-site-data"); + g_return_if_fail (site != NULL); + + g_clear_pointer (&site->image_def, gtk_image_definition_unref); + site->image_def = gtk_image_definition_new_surface (surface); +} + +/** * gtk_drag_source_set_icon_name: (method) * @widget: a #GtkWidget * @icon_name: name of icon to use |