From 0ad1de34923b2ff21e69f085e6c840fe0167739d Mon Sep 17 00:00:00 2001 From: Matias De lellis Date: Thu, 16 Oct 2014 12:41:00 -0300 Subject: [PATCH] Add a description of the property shadow-blur-radius on README file. (Bug 11228) Ensure that shadow_blur_radius > 1 before call to paint the shadow. Save the cairo_t before change it, and so can be recovered correctly. --- README | 10 +++++++--- src/xfdesktop-icon-view.c | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README b/README index 917a7cc..14c1529 100644 --- a/README +++ b/README @@ -51,6 +51,7 @@ style "xfdesktop-icon-view" { XfdesktopIconView::selected-shadow-x-offset = 2 XfdesktopIconView::selected-shadow-y-offset = 2 XfdesktopIconView::selected-shadow-color = "#00ff00" + XfdesktopIconView::shadow-blur-radius = 2 XfdesktopIconView::cell-spacing = 2 XfdesktopIconView::cell-padding = 6 @@ -75,10 +76,13 @@ determines how large the image preview will be when the mouse is hovered over an icon (allowed values are from 0 (not shown) to 512, values larger than 256 may cause poor image quality however.) -The second six entries can be used to enable a text shadow to be painted -with the icon labels. The offsets are in pixels. Setting them to 0 (the +The second seven entries can be used to enable a text shadow to be painted +with the icon labels. The offsets are in pixels. Setting them to 0 (the defaults) will disable the shadows entirely. Again, the 'selected-' -versions apply to icons that have been selected with the mouse. +versions apply to icons that have been selected with the mouse. The +shadow-blur-radius property optionally applies a blur to the shadows when +it is greater than 1 improving the style, but needs a little more CPU +processing, and therefore also is disabled by default. The third four entries set spacing and sizing for individual icons on the grid. The 'cell-spacing' property specifies the spacing between each diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c index cade043..a1252ce 100644 --- a/src/xfdesktop-icon-view.c +++ b/src/xfdesktop-icon-view.c @@ -2975,6 +2975,8 @@ xfdesktop_icon_view_draw_text(cairo_t *cr, PangoLayout *playout, GdkRectangle *t { GdkRectangle box_area; + cairo_save(cr); + gint extents = _gtk_cairo_blur_compute_pixels(blur_radius); /* Extend even more the rectangle to not cut the shadows. */ @@ -2991,7 +2993,7 @@ xfdesktop_icon_view_draw_text(cairo_t *cr, PangoLayout *playout, GdkRectangle *t cairo_move_to(cr, box_area.x + extents + x_offset - rtl_offset, box_area.y + extents + y_offset); - cairo_save(cr); + if (blur_radius > 1) { cr = gtk_css_shadow_value_start_drawing (cr, blur_radius); @@ -3095,7 +3097,7 @@ xfdesktop_icon_view_paint_icon(XfdesktopIconView *icon_view, } /* draw text shadow for the label text if an offset was defined */ - if(x_offset || y_offset || icon_view->priv->shadow_blur_radius) { + if(x_offset || y_offset || (icon_view->priv->shadow_blur_radius > 1)) { /* Draw the shadow */ xfdesktop_icon_view_draw_text(cr, playout, &text_extents, -- 1.9.3