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);