From: Benjamin Otte Date: Mon, 26 Mar 2018 04:26:34 +0000 (+0200) Subject: colorbutton: Port dnd icon to paintable X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~22^2~788 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8e3e321da480f3b21bbc260505daceaf7f5cfb62;p=gtk4.git colorbutton: Port dnd icon to paintable Patch is untested, because colorbuttons can't do DND at the moment. --- diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 91d2395620..4ef68a1875 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -31,7 +31,6 @@ #include "gtkcolorbutton.h" #include "gtkbutton.h" -#include "gtkmain.h" #include "gtkcolorchooser.h" #include "gtkcolorchooserprivate.h" #include "gtkcolorchooserdialog.h" @@ -39,9 +38,11 @@ #include "gtkdnd.h" #include "gtkdragdest.h" #include "gtkdragsource.h" +#include "gtkintl.h" +#include "gtkmain.h" #include "gtkmarshalers.h" #include "gtkprivate.h" -#include "gtkintl.h" +#include "gtksnapshot.h" /** @@ -322,19 +323,17 @@ static void set_color_icon (GdkDragContext *context, const GdkRGBA *rgba) { - cairo_surface_t *surface; - cairo_t *cr; - - surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 48, 32); - cr = cairo_create (surface); - - gdk_cairo_set_source_rgba (cr, rgba); - cairo_paint (cr); + GtkSnapshot *snapshot; + GdkPaintable *paintable; - gtk_drag_set_icon_surface (context, surface); + snapshot = gtk_snapshot_new (FALSE, NULL, "ColorDragIcon"); + gtk_snapshot_append_color (snapshot, + rgba, + &GRAPHENE_RECT_INIT(0, 0, 48, 32), + "ColorDragColor"); + paintable = gtk_snapshot_free_to_paintable (snapshot); - cairo_destroy (cr); - cairo_surface_destroy (surface); + gtk_drag_set_icon_paintable (context, paintable, 0, 0); } static void