From 03443ffcc14d9a9fa9e2fd2f7ef034076b289e7c Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 17 Aug 2025 01:33:14 +0000 Subject: [PATCH] text: Don't call size_changed when typing This patch provides a temporary fix for issue 14442. Currently, gimp_drawable_size_changed () is called whenever a drawable's size changes (like by scaling, rotating, resizing, etc). When called, it resizes filters to the layer's new width and height. Unfortunately, it is currently also called when typing new text, as that changes the layer size too. This causes filters like Drop Shadow to be cut-off because they originally extended outside the bounds of the layer. This patch checks if the layer has been rasterized - if it hasn't, then size_changed () is not called. As stated, this is a temporary fix for GIMP 3.1.4, and will likely be replaced with a more permanent fix for GIMP 3.2 --- app/text/gimptextlayer.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c index 0745fd1a3c..cd2017e92f 100644 --- a/app/text/gimptextlayer.c +++ b/app/text/gimptextlayer.c @@ -85,6 +85,8 @@ static void gimp_text_layer_set_property (GObject *object, static gint64 gimp_text_layer_get_memsize (GimpObject *object, gint64 *gui_size); +static void gimp_text_layer_size_changed (GimpViewable *viewable); + static GimpItem * gimp_text_layer_duplicate (GimpItem *item, GType new_type); static gboolean gimp_text_layer_rename (GimpItem *item, @@ -144,6 +146,7 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass) viewable_class->default_icon_name = "gimp-text-layer"; viewable_class->default_name = _("Text Layer"); + viewable_class->size_changed = gimp_text_layer_size_changed; item_class->duplicate = gimp_text_layer_duplicate; item_class->rename = gimp_text_layer_rename; @@ -272,6 +275,19 @@ gimp_text_layer_get_memsize (GimpObject *object, gui_size); } +static void +gimp_text_layer_size_changed (GimpViewable *viewable) +{ + GimpTextLayer *text_layer = GIMP_TEXT_LAYER (viewable); + + /* TODO: For now, we only let the size_changed () call bubble up to + * gimp_drawable_size_changed () if the layer has been rasterized by + * a transform. This prevents filters like Drop Shadow from being + * cropped just by typing */ + if (text_layer->modified) + GIMP_VIEWABLE_CLASS (parent_class)->size_changed (viewable); +} + static GimpItem * gimp_text_layer_duplicate (GimpItem *item, GType new_type)