[gimp] app: some fixes/improvements.



commit 5d14a7a595d7dd20d572b5328c84fcccb6f29479
Author: Jehan <jehan girinstud io>
Date:   Sat Aug 1 12:04:04 2020 +0200

    app: some fixes/improvements.
    
    Forgot to free a list.
    Also getting rid of a gimp_image_get_active_drawable() in edit_paste(),
    with logics staying the same.

 app/actions/edit-commands.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c
index 833ff79bf8..e2551fef9a 100644
--- a/app/actions/edit-commands.c
+++ b/app/actions/edit-commands.c
@@ -543,6 +543,7 @@ edit_fill_cmd_callback (GimpAction *action,
       g_clear_error (&error);
     }
 
+  g_list_free (drawables);
   g_object_unref (options);
 }
 
@@ -610,11 +611,22 @@ edit_paste (GimpDisplay   *display,
 
   if (paste)
     {
-      GimpDisplayShell *shell    = gimp_display_get_shell (display);
-      GimpDrawable     *drawable = gimp_image_get_active_drawable (image);
+      GimpDisplayShell *shell     = gimp_display_get_shell (display);
+      GList            *drawables = gimp_image_get_selected_drawables (image);
+      GimpDrawable     *drawable  = NULL;
       gint              x, y;
       gint              width, height;
 
+      /* Paste on multiple selection is probably wrong right now (though
+       * I guess it can be argued). For now we just default to the same
+       * as pasting with no selected drawable, which will just create a
+       * new drawable.
+       */
+      if (g_list_length (drawables) == 1)
+        drawable = drawables->data;
+
+      g_list_free (drawables);
+
       if (drawable                                &&
           paste_type != GIMP_PASTE_TYPE_NEW_LAYER &&
           paste_type != GIMP_PASTE_TYPE_NEW_LAYER_IN_PLACE)


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