app: defer GimpViewable::size-changed signal emission while frozen

In GimpViewable, defer emission of the size-changed signal while
the viewable's preview is frozen, and only emit the signal once
thawed.
This commit is contained in:
Ell 2019-09-04 17:08:46 +03:00
parent e2f31852fb
commit a64dc8d618
1 changed files with 16 additions and 1 deletions

View File

@ -68,6 +68,7 @@ struct _GimpViewablePrivate
GdkPixbuf *icon_pixbuf;
gint freeze_count;
gboolean invalidate_pending;
gboolean size_changed_prending;
GimpViewable *parent;
gint depth;
@ -599,9 +600,16 @@ gimp_viewable_invalidate_preview (GimpViewable *viewable)
void
gimp_viewable_size_changed (GimpViewable *viewable)
{
GimpViewablePrivate *private;
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
g_signal_emit (viewable, viewable_signals[SIZE_CHANGED], 0);
private = GET_PRIVATE (viewable);
if (private->freeze_count == 0)
g_signal_emit (viewable, viewable_signals[SIZE_CHANGED], 0);
else
private->size_changed_prending = TRUE;
}
/**
@ -1302,6 +1310,13 @@ gimp_viewable_preview_thaw (GimpViewable *viewable)
if (private->freeze_count == 0)
{
if (private->size_changed_prending)
{
private->size_changed_prending = FALSE;
gimp_viewable_size_changed (viewable);
}
if (private->invalidate_pending)
{
private->invalidate_pending = FALSE;