--- xfdesktop.bak/src/xfdesktop-icon-view.c 2008-09-20 15:11:12.000000000 +0200 +++ xfdesktop/src/xfdesktop-icon-view.c 2008-09-25 11:12:53.000000000 +0200 @@ -75,6 +75,8 @@ #define DUMP_GRID_LAYOUT(icon_view) #endif +#define DEFAULT_SHADOW_COLOR "#000000" + typedef enum { XFDESKTOP_DIRECTION_UP = 0, @@ -150,6 +152,9 @@ struct _XfdesktopIconViewPrivate GdkPixbuf *rounded_frame; gint label_alpha; + gint active_label_alpha; + + gchar *label_shadow_color; #if !GTK_CHECK_VERSION(2, 12, 0) guint tip_show_id; @@ -362,6 +367,20 @@ xfdesktop_icon_view_class_init(Xfdesktop "Alpha value for the text label's background", 0, 255, 155, G_PARAM_READABLE)); + + gtk_widget_class_install_style_property(widget_class, + g_param_spec_int("active-label-alpha", + "Active icons label alpha", + "Alpha value for the text label's background for active icons", + 0, 255, 155, + G_PARAM_READABLE)); + + gtk_widget_class_install_style_property(widget_class, + g_param_spec_string("label-shadow-color", + "Active icons label text shadow color", + "Color for the text shadows of the icon labels", + DEFAULT_SHADOW_COLOR, + G_PARAM_READABLE)); xfdesktop_cell_highlight_quark = g_quark_from_static_string("xfdesktop-icon-view-cell-highlight"); } @@ -1376,7 +1395,19 @@ xfdesktop_icon_view_style_set(GtkWidget gtk_widget_style_get(GTK_WIDGET(icon_view), "label-alpha", &icon_view->priv->label_alpha, NULL); - DBG("label alpha is %d", icon_view->priv->label_alpha); + + gtk_widget_style_get(GTK_WIDGET(icon_view), + "active-label-alpha", &icon_view->priv->active_label_alpha, + NULL); + + gtk_widget_style_get(GTK_WIDGET(icon_view), + "label-shadow-color", &icon_view->priv->label_shadow_color, + NULL); + + + DBG("label alpha for icons in normal state is %d", icon_view->priv->label_alpha); + DBG("label alpha for active icons is %d", icon_view->priv->active_label_alpha); + DBG("label shadow color for active icons is %s", icon_view->priv->label_shadow_color); GTK_WIDGET_CLASS(xfdesktop_icon_view_parent_class)->style_set(widget, previous_style); @@ -1941,6 +1972,7 @@ xfdesktop_paint_rounded_box(XfdesktopIco GdkRectangle *expose_area) { GdkRectangle intersection; + gint alpha; /* make sure to undo this before returning */ text_area->x -= CORNER_ROUNDNESS; @@ -1963,11 +1995,17 @@ xfdesktop_paint_rounded_box(XfdesktopIco xfdesktop_clear_rounded_corners(box_pix, icon_view->priv->rounded_frame); + + if (state == GTK_STATE_NORMAL) + alpha = icon_view->priv->label_alpha; + else + alpha = icon_view->priv->active_label_alpha; + xfdesktop_multiply_pixbuf_rgba(box_pix, EEL_RGBA_COLOR_PACK(style->base[state].red >> 8, style->base[state].green >> 8, style->base[state].blue >> 8, - icon_view->priv->label_alpha)); + alpha)); gdk_draw_pixbuf(GDK_DRAWABLE(GTK_WIDGET(icon_view)->window), NULL, box_pix, intersection.x - text_area->x, @@ -2085,6 +2123,38 @@ xfdesktop_icon_view_paint_icon(Xfdesktop memcpy(&adj_area, area, sizeof(GdkRectangle)); xfdesktop_paint_rounded_box(icon_view, state, &text_area, &adj_area); + + /* draw text shadow for the text of "normal" icons if the + * label background is totally transparent */ + if ((state == GTK_STATE_NORMAL) && (!icon_view->priv->label_alpha)) { + GdkColor shadow_color; + GdkGC *tmp_gc; + + /* if the color value could not be parsed, default to black */ + if (!gdk_color_parse(icon_view->priv->label_shadow_color, + &shadow_color)) + icon_view->priv->label_shadow_color = DEFAULT_SHADOW_COLOR; + + /* save the original gc */ + tmp_gc = gdk_gc_new(GDK_DRAWABLE(widget->window)); + gdk_gc_copy(tmp_gc, widget->style->text_gc[state]); + + /* set the new foreground color */ + gdk_gc_set_rgb_fg_color(widget->style->text_gc[state], + &shadow_color); + + /* paint the shadow */ + gtk_paint_layout(widget->style, widget->window, state, TRUE, + &adj_area, widget, "label", text_area.x + 1 , + text_area.y + 1, playout); + + /* restore the original gc */ + gdk_gc_copy(widget->style->text_gc[state], tmp_gc); + + /* clean */ + g_object_unref(G_OBJECT(tmp_gc)); + } + gtk_paint_layout(widget->style, widget->window, state, FALSE, &adj_area, widget, "label", text_area.x, text_area.y, playout);