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
This commit is contained in:
Alx Sa 2025-08-17 01:33:14 +00:00
parent 4f6036e3e6
commit 03443ffcc1

View file

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