[Xfce4-commits] <xfwm4:master> Revert part of git commit c1a867e6 by copying over code that was removed with the deprecation of libxfcegui4 (but #6313)
Olivier Fourdan
noreply at xfce.org
Tue Mar 16 15:12:01 CET 2010
Updating branch refs/heads/master
to e6bdc3b1589a80804aef78c737b0614f1912ed7e (commit)
from c9120a4f6c8b7f28edfe76204cd2fa4a4e44a3eb (commit)
commit e6bdc3b1589a80804aef78c737b0614f1912ed7e
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Tue Mar 16 15:08:13 2010 +0100
Revert part of git commit c1a867e6 by copying over code that was removed with the deprecation of libxfcegui4 (but #6313)
src/icons.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/src/icons.c b/src/icons.c
index 3b7fcbf..cfe31e7 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -38,6 +38,45 @@
#include "display.h"
#include "hints.h"
+/*
+ * create a GdkPixbuf from inline data and scale it to a given size
+ */
+static GdkPixbuf *
+inline_icon_at_size (const guint8 *data,
+ int width,
+ int height)
+{
+ GdkPixbuf *base;
+
+ base = gdk_pixbuf_new_from_inline (-1, data, FALSE, NULL);
+
+ g_return_val_if_fail (base, NULL);
+
+ if ((width < 0 && height < 0)
+ || (gdk_pixbuf_get_width (base) == width
+ && gdk_pixbuf_get_height (base) == height))
+ {
+ return base;
+ }
+ else
+ {
+ GdkPixbuf *scaled;
+
+ scaled = gdk_pixbuf_scale_simple (base,
+ width >
+ 0 ? width : gdk_pixbuf_get_width (base),
+ height >
+ 0 ? height :
+ gdk_pixbuf_get_height (base),
+ GDK_INTERP_BILINEAR);
+
+ g_object_unref (G_OBJECT (base));
+
+ return scaled;
+ }
+}
+
+
static gboolean
find_largest_sizes (gulong * data, gulong nitems, int *width, int *height)
{
@@ -521,5 +560,5 @@ getAppIcon (DisplayInfo *display_info, Window window, int width, int height)
}
}
- return NULL; /*xfce_inline_icon_at_size (default_icon_data, width, height);*/
+ inline_icon_at_size (default_icon_data, width, height);
}
More information about the Xfce4-commits
mailing list