[gimp] app: defer GimpViewable::size-changed signal emission while frozen



commit a64dc8d61880bd80a175bac5de8556d886ac167e
Author: Ell <ell_se yahoo com>
Date:   Wed Sep 4 17:08:46 2019 +0300

    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.

 app/core/gimpviewable.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpviewable.c b/app/core/gimpviewable.c
index 92b33cab38..d43badf93f 100644
--- a/app/core/gimpviewable.c
+++ b/app/core/gimpviewable.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]