From 975d1a4aa371e2578952bfff2db3a14d9fc35f0d Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 9 Mar 2025 16:06:35 +0000 Subject: [PATCH] core, display: Enable resize for GUI layer copying Resolves #12428 (for now) As noted by Thomas Manni, GimpDrawable does not initialize its push_resize_undo value except via gimp_drawable_new (). If the drawable is created in some other way, it defaults to FALSE and does not save the original size in history when resized or cropped. Thomas proposed initializing it to TRUE in the init () function. This is likely the correct approach, but could cause some new bugs right before the 3.0 release. For now, this patch calls gimp_drawable_enable_resize_undo () for GUI-specific operations (like opening as layers or dragging and dropping layers) to fix the regression for 3.0. Afterwards, we can spend time confirming the init () approach and switch over to that. --- app/core/gimpimage.c | 1 + app/display/gimpdisplayshell-dnd.c | 1 + 2 files changed, 2 insertions(+) diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 202ab3439f..3374c3de42 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -5497,6 +5497,7 @@ gimp_image_add_layers (GimpImage *image, gimp_image_add_layer (image, GIMP_LAYER (new_item), parent, position, TRUE); + gimp_drawable_enable_resize_undo (GIMP_DRAWABLE (new_item)); position++; } diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index 3d50f613e1..5a72d84c53 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -292,6 +292,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget, gimp_image_add_layer (image, new_layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE); + gimp_drawable_enable_resize_undo (GIMP_DRAWABLE (new_layer)); gimp_image_undo_group_end (image);