From d8d8e7a0e8af6abe07bbe5b2ccf079902fd25b41 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sat, 14 Mar 2026 02:13:54 +0000 Subject: [PATCH] widgets: Allow DnD for vector layers in dock 916cf84e handles dragging and dropping colors onto vector layers on the canvas. However, we did not handle what happens if you drag and drop onto the layer dock. This patch adds logic to gimp_layer_tree_view_drop_color () so that it also updates the vector layer fill, instead of treating the vector layer like a raster layer and filling the whole layer with the color. --- app/widgets/gimplayertreeview.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 8794eed462..782414a7bd 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -40,6 +40,7 @@ #include "core/gimpchannel.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" +#include "core/gimpfilloptions.h" #include "core/gimpimage-undo.h" #include "core/gimpimage-undo-push.h" #include "core/gimpimage.h" @@ -50,6 +51,9 @@ #include "core/gimplayermask.h" #include "core/gimptreehandler.h" +#include "path/gimpvectorlayer.h" +#include "path/gimpvectorlayeroptions.h" + #include "text/gimptextlayer.h" #include "file/file-open.h" @@ -736,14 +740,37 @@ gimp_layer_tree_view_drop_color (GimpContainerTreeView *view, GimpViewable *dest_viewable, GtkTreeViewDropPosition drop_pos) { + GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view); + if (gimp_item_is_text_layer (GIMP_ITEM (dest_viewable))) { gimp_text_layer_set (GIMP_TEXT_LAYER (dest_viewable), NULL, "color", color, NULL); - gimp_image_flush (gimp_item_tree_view_get_image (GIMP_ITEM_TREE_VIEW (view))); + gimp_image_flush (gimp_item_tree_view_get_image (item_view)); return; } + else if (gimp_item_is_vector_layer (GIMP_ITEM (dest_viewable))) + { + GimpVectorLayerOptions *vector_options = NULL; + GimpFillOptions *vector_fill = NULL; + + vector_options = + gimp_vector_layer_get_options (GIMP_VECTOR_LAYER (dest_viewable)); + if (vector_options) + vector_fill = vector_options->fill_options; + + if (vector_fill) + { + gimp_context_set_foreground (GIMP_CONTEXT (vector_fill), color); + gimp_fill_options_set_custom_style (vector_fill, + GIMP_CUSTOM_STYLE_SOLID_COLOR); + + gimp_vector_layer_refresh (GIMP_VECTOR_LAYER (dest_viewable)); + gimp_image_flush (gimp_item_tree_view_get_image (item_view)); + return; + } + } GIMP_CONTAINER_TREE_VIEW_CLASS (parent_class)->drop_color (view, color, dest_viewable,