diff -ur src/xfce_theme_draw.c src/xfce_theme_draw.c --- src/xfce_theme_draw.c 2011-01-16 16:40:26.000000000 +0100 +++ src/xfce_theme_draw.c 2011-02-26 02:42:51.440000006 +0100 @@ -424,6 +424,65 @@ } } +static GdkPixbuf * xfce_set_transparency (GdkPixbuf * src, gfloat alpha) +{ + GdkPixbuf *dst; + guchar *data, *current; + guint x, y, rowstride, height, width; + + g_return_val_if_fail(src != NULL, NULL); + g_return_val_if_fail(GDK_IS_PIXBUF (src), NULL); + + dst = gdk_pixbuf_add_alpha (src, FALSE, 0, 0, 0); + + width = gdk_pixbuf_get_width(dst); + height = gdk_pixbuf_get_height(dst); + rowstride = gdk_pixbuf_get_rowstride(dst); + data = gdk_pixbuf_get_pixels(dst); + + for (y = 0; y < height; y++) + { + current = data + 3; + + for (x = 0; x < width; x++) + { + *current *= alpha; + + current += 4; + } + + data += rowstride; + } + + return dst; +} + +static GdkPixbuf * render_icon (GtkStyle * style, const GtkIconSource * source, GtkTextDirection direction, GtkStateType state, GtkIconSize size, GtkWidget * widget, const gchar * detail) +{ + GdkPixbuf *scaled, *stated; + GtkStateType render_state = state; + + if (state == GTK_STATE_INSENSITIVE) + { + render_state = GTK_STATE_NORMAL; + } + + scaled = parent_class->render_icon(style, source, direction, render_state, size, widget, detail); + + if (state == GTK_STATE_INSENSITIVE && scaled != NULL) + { + stated = xfce_set_transparency(scaled, 0.5); + + gdk_pixbuf_saturate_and_pixelate(stated, stated, 0.5, FALSE); + + g_object_unref(scaled); + + scaled = stated; + } + + return scaled; +} + static void draw_hline(GtkStyle * style, GdkWindow * window, GtkStateType state_type, GdkRectangle * area, GtkWidget * widget, const gchar * detail, gint x1, gint x2, gint y) { gint thickness_light; @@ -1380,6 +1439,7 @@ GtkStyleClass *style_class = GTK_STYLE_CLASS(klass); parent_class = g_type_class_peek_parent(klass); + style_class->render_icon = render_icon; style_class->draw_hline = draw_hline; style_class->draw_vline = draw_vline; style_class->draw_shadow = draw_shadow;