From a4cfa25822ffb5d9baf85cea98630dff157ca4a8 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sat, 30 Mar 2024 15:44:39 +0000 Subject: [PATCH] core: Put floating selections under layer effects Resolves #11147 Applying the same reordering code in cbb1e816 to adding a floating selection. When anchored, floating selections were also merging down all layer effects onto the original image. This patch places the float selection under the layer effect when added, both to prevent this and because it seems to be the expected behavior based on user feedback. --- app/core/gimpdrawable-floating-selection.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/core/gimpdrawable-floating-selection.c b/app/core/gimpdrawable-floating-selection.c index ac1a1420ea..acc9e771bc 100644 --- a/app/core/gimpdrawable-floating-selection.c +++ b/app/core/gimpdrawable-floating-selection.c @@ -28,6 +28,7 @@ #include "gegl/gimpapplicator.h" #include "gimpchannel.h" +#include "gimpcontainer.h" #include "gimpdrawable-floating-selection.h" #include "gimpdrawable-filters.h" #include "gimpdrawable-private.h" @@ -192,10 +193,13 @@ void _gimp_drawable_add_floating_sel_filter (GimpDrawable *drawable) { GimpDrawablePrivate *private = drawable->private; + GimpContainer *filters = gimp_drawable_get_filters (drawable); GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); GimpLayer *fs = gimp_drawable_get_floating_sel (drawable); GeglNode *node; GeglNode *fs_source; + gint end_index; + gint index; if (! private->source_node) return; @@ -234,6 +238,15 @@ _gimp_drawable_add_floating_sel_filter (GimpDrawable *drawable) gimp_drawable_add_filter (drawable, private->fs_filter); + /* Move the floating selection below any non-destructive filters that + * may be active, so that it's directly affect the raw pixels. */ + end_index = gimp_container_get_n_children (filters) - 1; + index = + gimp_container_get_child_index (filters, GIMP_OBJECT (private->fs_filter)); + if (end_index > 0 && index != end_index) + gimp_container_reorder (filters, GIMP_OBJECT (private->fs_filter), + end_index); + g_signal_connect (fs, "notify", G_CALLBACK (gimp_drawable_fs_notify), drawable);