Created attachment 5679 Comparation before and after applying the patch using Greybird theme Hi All, I have another proposal to xfdesktop: Blur the shadow of the text icons. I made the first test, and now attach the results: No improves the text visibility as I expected, but really going more beautiful.. What do you think?. Well, after many turns (Cairo does not implement it natively, and there are thousands of example of how to do it, each one with different results), I'm using Gtk+-3 code to do this: # https://git.gnome.org/browse/gtk+/tree/gtk/gtkcairoblur.c And adapt the necessary functions from here: # https://git.gnome.org/browse/gtk+/tree/gtk/gtkcssshadowvalue.c Well, obviously, this means more CPU usage, but is supposed that is optimized.. And the patch keeps doing this optional, adding a new property called "shadow-blur-radius" on gtkrc file. If the "shadow-blur-radius" does not exist or is zero, it is shaded as before. If greater than 1, applies blur. =) All comments are welcome. ;) Regards, Matias.
Created attachment 5680 [Patch] Implement optional blur to shadow on icons text
Hi Again, Small update, is disgustingly slow.. I said that would consume more CPU.. but I never thought it would be so slow. :( With a 2-pixel blur takes more than two seconds to change the desktop image. Now I was investigating change the Gaussian bluring by one exponential, and decreases the time a lot but still seems slow.. I'm seeing how can be optimized... Regards.
Tiny update. I just discovered why is so slow.. In short, I am applying to blur the entire screen... Once for each icon painting.. The xfdesktop code is very inefficient is this.. Each time you draw an icon, a text, or a shadow, does it on a region that occupies the entire screen wasting CPU and memory.. rather than changing only the region involved and then apply a mask. All current drawings do not require large amounts of CPU (virtually nothing), so maybe it's exaggerated, but adding any effects, it is completely a waste.. :S However, I must admit that Cairo's new to me. I have to continue investigating. Regards.
Oh, interesting idea! About speeding it up, Xfdesktop gets a series of rectangles in xfdesktop_icon_view_expose and should just repaint the clipbox. I never looked to see if that ends up being the entire desktop... Perhaps we can improve that. gdk_region_get_rectangles(evt->region, &rects, &n_rects); gdk_region_get_clipbox(evt->region, &clipbox); http://git.xfce.org/xfce/xfdesktop/tree/src/xfdesktop-icon-view.c#n2062
Ok. I have no idea how this clipbox work but will investigate.. :S However observe that always finishes running the function "xfdesktop_icon_view_paint_icon()" On this function create a cairo_t, using the screen region. > cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); // Note that widget = GTK_WIDGET(icon_view); * http://git.xfce.org/xfce/xfdesktop/tree/src/xfdesktop-icon-view.c#n2994 ..and this is used to build the shadow: http://git.xfce.org/xfce/xfdesktop/tree/src/xfdesktop-icon-view.c#n3065 The rest of the drawings seems that is better controlled, and is made by drawing regions, but not here that uses the entire region. In my tests apply the blur to this cairo_t.. :S
Created attachment 5692 [Patch] Implement optional blur to shadow on icons text Changes since first patch: * Crop bluring area, fixing the performance problem. * Move all gtk+-3 code to the same file, and add a note on their origin. * Only blur when radius > 1
Hi Eric, Now works correctly except that the shadow is a little trimmed on right. Would have to extend the GdkRectangle text_extents to be a bit bigger and fit all the shade. I tried, but it moves the text. :( Ahh.. to test you must add: XfdesktopIconView::shadow-blur-radius = 2 to xfdesktop-icon-view style of your gtk2 favorite theme. =)
Created attachment 5693 [Patch] Implement optional blur to shadow on icons text Fixes the cut on shadow.
Thanks! Pushed to master in: http://git.xfce.org/xfce/xfdesktop/commit/?id=7e8e8669606e662d1ee1e85815000f068f48acd9 Minor note, in the future you may want to make the git commit header look a little nicer (I know I'm not a great example). Naturally I can't find a good tutorial right away but something like: Add optional blurring on shadow on text of icons. In general backported gtk+-3 code to implement it.. Add a new property called "shadow-blur-radius" on gtkrc file. If the "shadow-blur-radius" does not exist or is zero, it is shaded as before. If greater than 1, applies blur. So it looks more like: http://git.xfce.org/xfce/thunar/commit/?id=6a63d7bd8ff0d937cb30f112c3fd080a5a107053 instead of: http://git.xfce.org/xfce/xfdesktop/commit/?id=7e8e8669606e662d1ee1e85815000f068f48acd9 But it's obviously not a big deal, thanks again for your work!
Thank you for even considering my changes!. ;) The next step that I want to do is center the text on icons. About the commits descriptions, I have to improve. I usually write mere titles, and in this case I wanted to add an explanation of the new property, but I forget to cut it correctly and also is nice add the number of bug involved. MM.. Maybe also we should add this to the README One detail that I just saw on the commit. http://git.xfce.org/xfce/xfdesktop/tree/src/xfdesktop-icon-view.c#n2994 This cairo_save(cr) should be made before cut the cairo on line: http://git.xfce.org/xfce/xfdesktop/tree/src/xfdesktop-icon-view.c#n2989 It not affect in anything, due it is the last use of cairo_t, but is a good detail save the state before modifying.. ;S If you want I can make another patch, but it is fast, and I can not do it until a few hours. :s Regards.
Created attachment 5694 Add description on Readme and a minor fix to previus path. * Add a description of the property shadow-blur-radius on README file * 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. About the description, please review it. Talk About the use of cpu, and maybe something alarmist. haha.. ;)
Description looks good. I was just about to reply when this came in, great timing! Pushed to master. Thanks again for writing the patches! The next dev release might be all your work at this rate :)
Created attachment 5930 Add 1px to widen the text shadow and improve contrast. Hi Eric, I hope you get this!. You notice that the shadow are very clear and become invisible when use blur?. This patch only adds a pixel around the letters to widen it a bit, and when applying the bluring, the shadow is much stronger improving the visibility of text. Now also upload a screenshot so you can see the difference.
Created attachment 5931 Before and after the new patch Before and after the new patch.. Both with a 2-pixel blur and 1px offset.
Looks good, pushed to master in: commit 9ac6329aa6451f261fc366901492eb002de8d62c Author: Matias De lellis <mati86dl@gmail.com> Date: Wed Feb 11 20:14:00 2015 -0300 Add 1px to widen the text shadow and improve contrast. http://git.xfce.org/xfce/xfdesktop/commit/?id=9ac6329aa6451f261fc366901492eb002de8d62c