[Xfce4-commits] [xfce/xfwm4] 05/07: Use default icon if preview in not available

noreply at xfce.org noreply at xfce.org
Fri Feb 6 22:23:10 CET 2015


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit deda565b501533cd57db714441bece3bc17a1aad
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Fri Feb 6 22:12:39 2015 +0100

    Use default icon if preview in not available
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/icons.c |   55 +++++++++++++++++++++++++++----------------------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/icons.c b/src/icons.c
index 58b356a..1066f1e 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -580,8 +580,11 @@ GdkPixbuf *
 getClientIcon (Client *c, guint width, guint height)
 {
     ScreenInfo *screen_info;
+    GdkPixbuf *app_content;
+    GdkPixbuf *small_icon;
     GdkPixbuf *icon_pixbuf;
     GdkPixbuf *icon_pixbuf_stated;
+    guint small_icon_size;
     guint app_icon_width, app_icon_height;
     Pixmap pixmap;
 
@@ -592,45 +595,41 @@ getClientIcon (Client *c, guint width, guint height)
     app_icon_width = width; /* Set to 0 to use gdk pixbuf scaling */
     app_icon_height = height; /* Set to 0 to use gdk pixbuf scaling */
 
+    icon_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
+    gdk_pixbuf_fill (icon_pixbuf, 0x00);
+
     pixmap = compositorGetWindowPixmapAtSize (screen_info, c->frame, &app_icon_width, &app_icon_height);
     if (pixmap != None)
     {
-        GdkPixbuf *app_content;
-        GdkPixbuf *small_icon;
-        guint small_icon_size;
-
-        icon_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
-        gdk_pixbuf_fill (icon_pixbuf, 0x00);
-
         app_content = try_pixmap_and_mask (screen_info, pixmap, None, width, height);
         XFreePixmap (myScreenGetXDisplay (screen_info), pixmap);
+    }
+    else
+    {
+        app_content = inline_icon_at_size (default_icon_data, width, height);
+    }
 
-        app_icon_width = (guint) gdk_pixbuf_get_width (app_content);
-        app_icon_height = (guint) gdk_pixbuf_get_height (app_content);
+    app_icon_width = (guint) gdk_pixbuf_get_width (app_content);
+    app_icon_height = (guint) gdk_pixbuf_get_height (app_content);
 
-        gdk_pixbuf_copy_area (app_content, 0, 0, app_icon_width, app_icon_height, icon_pixbuf,
-                              (width - app_icon_width) / 2, (height - app_icon_height) / 2);
-        g_object_unref (app_content);
+    gdk_pixbuf_copy_area (app_content, 0, 0, app_icon_width, app_icon_height, icon_pixbuf,
+                          (width - app_icon_width) / 2, (height - app_icon_height) / 2);
+    g_object_unref (app_content);
 
-        small_icon_size = MIN (width / 4, height / 4);
-        small_icon_size = MIN (small_icon_size, 48);
+    small_icon_size = MIN (width / 4, height / 4);
+    small_icon_size = MIN (small_icon_size, 48);
 
-        small_icon = getAppIcon (screen_info, c->window, small_icon_size, small_icon_size);
+    small_icon = getAppIcon (screen_info, c->window, small_icon_size, small_icon_size);
 
-        gdk_pixbuf_composite (small_icon, icon_pixbuf,
-                              (width - small_icon_size) / 2, height - small_icon_size,
-                              small_icon_size, small_icon_size,
-                              (width - small_icon_size) / 2, height - small_icon_size,
-                              1.0, 1.0,
-                              GDK_INTERP_BILINEAR,
-                              0xff);
+    gdk_pixbuf_composite (small_icon, icon_pixbuf,
+                          (width - small_icon_size) / 2, height - small_icon_size,
+                          small_icon_size, small_icon_size,
+                          (width - small_icon_size) / 2, height - small_icon_size,
+                          1.0, 1.0,
+                          GDK_INTERP_BILINEAR,
+                          0xff);
 
-        g_object_unref (small_icon);
-    }
-    else
-    {
-        icon_pixbuf = getAppIcon (screen_info, c->window, width, height);
-    }
+    g_object_unref (small_icon);
 
     if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
     {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list