Rodent and png icons

edscott wilson garcia edscott at xfce.org
Sun Oct 17 02:30:49 CEST 2004


El sáb, 16-10-2004 a las 17:02, Brian J. Tarricone escribió:
> edscott wilson garcia wrote:
> 
> >El vie, 15-10-2004 a las 21:52, Brian J. Tarricone escribió:
> >  
> >
> >>edscott wilson garcia wrote:
> >>    
> >>
> >>>I tweaked it just a bit, so that svg icons can be used as a backup if
> >>>png icon is not available when:
> >>>xfce_icon_theme_set_use_svg(icon_theme,FALSE);
> >>>since the idea is to speed up rendering of large icon sets, not limit
> >>>the rendering ability.
> >>>
> >>>I hope this is OK with you. If not, it can be reverted and I can get the
> >>>same result by installing the Rodent svg icons into a separate directory 
> >>>from the png icons (although I'd rather not).
> >>>      
> >>>
> >>hmm, i'm not sure i like that all that much.  that confuses the API a 
> >>bit, as it doesn't _really_ do what it says it does.  either you want 
> >>SVG or you don't; i don't think there should be an in-between.
> >>    
> >>
> >Yes, the tweak confuses the API, I wasn't too happy either. I'll revert
> >the proposed tweak... Reverted.
> >
> >There is a much better way, not a tweak but a fix:  if the requested
> >icon size matches the size of a png icon, the png icon should be
> >unconditionally preferred. There is no reason to scale an image that is
> >*already* to scale, right? 
> >  
> >
> that makes sense; good point.  i think it should be doable without 
> turning the lookup procedure into a nightmare.  i don't really have time 
> to look at this right now, but if you get to it first, feel free to see 
> if you can get it to work.  let me know how it goes.

I did something very simple: continue on svg icon, break on exact size
icon and continue on filename && not exact size. It changes one line and
adds only four new ones.

Works under all circumstances I can think of (you have to update the
Rodent theme to test, because many icon sizes were found to be broken).
I commited the fix (in three steps), I hope you don't mind, see patch
below.

regards,

Edscott
 
 

--- xfce-icontheme.c-1  2004-10-15 20:05:52.000000000 -0500
+++ xfce-icontheme.c    2004-10-16 09:30:39.000000000 -0500
@@ -663,14 +663,21 @@
        for(l = icons; l; l = l->next) {
                xicon = l->data;
                if(xicon->size == -1) {
-                       /* if we have a scalable (svg) image, take it
unconditionally */
+                       /* if we have a scalable (svg) image, take it
unconditionally
+                        * (if there is not an exact size match) */
                        filename = xicon->path;
-                       break;
+                       continue;
                } else {
                        /* if not, go through and attempt to find the
closest match */
                        gint this_diff, cur_closest_diff = 1000;

                        this_diff = icon_size - xicon->size;
+                       /* take exact match unconditionally (as long as
it is in the theme) */
+                       if (!this_diff && xicon->is_in_theme) {
+                               filename = xicon->path;
+                               break;
+                       }
+                       if (filename) continue;
                        if (this_diff < 0)
                                this_diff *= -1;
                        if(fuzzy_xicon){




More information about the Xfce4-dev mailing list