[gimp] app: window title stays single layer for now.



commit ac0287e2f33cea26bdcba45518557e4c18165912
Author: Jehan <jehan girinstud io>
Date:   Sat Aug 1 18:11:35 2020 +0200

    app: window title stays single layer for now.
    
    Logics stay the same except I replace gimp_image_get_active_drawable()
    by gimp_image_get_selected_drawables() to show I looked at this code.
    Basically it doesn't look like we can really handle multiple layer
    selected here, unless we want overly-long window titles.

 app/display/gimpdisplayshell-title.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 4b749bce38..b715b9c97f 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -176,7 +176,8 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
                                  const gchar      *format)
 {
   GimpImage    *image;
-  GimpDrawable *drawable;
+  GimpDrawable *drawable = NULL;
+  GList        *drawables;
   gint          num, denom;
   gint          i = 0;
 
@@ -190,7 +191,15 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
       return 0;
     }
 
-  drawable = gimp_image_get_active_drawable (image);
+  /* GIMP window title only take single selected layer into account so
+   * far (not sure how we could have multi-layer concept there, except
+   * wanting never-ending window titles!).
+   * When multiple drawables are selected, we just display nothing.
+   */
+  drawables = gimp_image_get_selected_drawables (image);
+  if (g_list_length (drawables) == 1)
+    drawable = drawables->data;
+  g_list_free (drawables);
 
   gimp_zoom_model_get_fraction (shell->zoom, &num, &denom);
 


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