[gimp] app: some more gimp_image_get_active_drawable() removed.



commit 892fbafdf85cface666ad76f9e60020c6d4b190a
Author: Jehan <jehan girinstud io>
Date:   Sun Aug 2 00:37:49 2020 +0200

    app: some more gimp_image_get_active_drawable() removed.
    
    No logics changed. These are places where we expect single layer
    selected.

 app/actions/buffers-commands.c          | 6 +++++-
 app/core/gimplayer-floating-selection.c | 8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c
index 14077fee19..c3b74b469e 100644
--- a/app/actions/buffers-commands.c
+++ b/app/actions/buffers-commands.c
@@ -88,11 +88,15 @@ buffers_paste_cmd_callback (GimpAction *action,
 
       if (image)
         {
-          gimp_edit_paste (image, gimp_image_get_active_drawable (image),
+          GList *drawables = gimp_image_get_selected_drawables (image);
+
+          gimp_edit_paste (image,
+                           g_list_length (drawables) == 1 ? drawables->data : NULL,
                            GIMP_OBJECT (buffer), paste_type,
                            x, y, width, height);
 
           gimp_image_flush (image);
+          g_list_free (drawables);
         }
     }
 }
diff --git a/app/core/gimplayer-floating-selection.c b/app/core/gimplayer-floating-selection.c
index cb0a482cdf..3ccb0af18a 100644
--- a/app/core/gimplayer-floating-selection.c
+++ b/app/core/gimplayer-floating-selection.c
@@ -69,7 +69,13 @@ floating_sel_attach (GimpLayer    *layer,
        *  to the drawable
        */
       if (drawable == (GimpDrawable *) floating_sel)
-        drawable = gimp_image_get_active_drawable (image);
+        {
+          GList *drawables = gimp_image_get_selected_drawables (image);
+
+          g_return_if_fail (g_list_length (drawables) == 1);
+          drawable = drawables->data;
+          g_list_free (drawables);
+        }
     }
 
   gimp_layer_set_lock_alpha (layer, TRUE, FALSE);


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