[gimp] app: update layer backdrop only after removing from stack



commit 99ab780d9fca6b43828da98e1009800539ec50d6
Author: Ell <ell_se yahoo com>
Date:   Fri May 12 15:34:28 2017 -0400

    app: update layer backdrop only after removing from stack
    
    When a layer is removed from a layer stack, and its backdrop needs
    invalidating, emit the UPDATE signals for the backdrop only after
    the layer has been removed from the container.

 app/core/gimplayerstack.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimplayerstack.c b/app/core/gimplayerstack.c
index e45138d..9f5d1f4 100644
--- a/app/core/gimplayerstack.c
+++ b/app/core/gimplayerstack.c
@@ -112,10 +112,19 @@ gimp_layer_stack_remove (GimpContainer *container,
                          GimpObject    *object)
 {
   GimpLayerStack *stack = GIMP_LAYER_STACK (container);
+  gboolean        update_backdrop;
+  gint            index;
 
-  gimp_layer_stack_update_backdrop (stack, GIMP_LAYER (object), FALSE, FALSE);
+  update_backdrop = gimp_item_get_visible (GIMP_ITEM (object)) &&
+                    gimp_layer_get_excludes_backdrop (GIMP_LAYER (object));
+
+  if (update_backdrop)
+    index = gimp_container_get_child_index (container, object);
 
   GIMP_CONTAINER_CLASS (parent_class)->remove (container, object);
+
+  if (update_backdrop)
+    gimp_layer_stack_update_range (stack, index, -1);
 }
 
 static void
@@ -124,18 +133,18 @@ gimp_layer_stack_reorder (GimpContainer *container,
                           gint           new_index)
 {
   GimpLayerStack *stack = GIMP_LAYER_STACK (container);
-  gboolean        excludes_backdrop;
+  gboolean        update_backdrop;
   gint            index;
 
-  excludes_backdrop = gimp_item_get_visible (GIMP_ITEM (object)) &&
-                      gimp_layer_get_excludes_backdrop (GIMP_LAYER (object));
+  update_backdrop = gimp_item_get_visible (GIMP_ITEM (object)) &&
+                    gimp_layer_get_excludes_backdrop (GIMP_LAYER (object));
 
-  if (excludes_backdrop)
+  if (update_backdrop)
     index = gimp_container_get_child_index (container, object);
 
   GIMP_CONTAINER_CLASS (parent_class)->reorder (container, object, new_index);
 
-  if (excludes_backdrop)
+  if (update_backdrop)
     gimp_layer_stack_update_range (stack, index, new_index);
 }
 


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