efreet: prefer downsizing

SVN revision: 48919
This commit is contained in:
Sebastian Dransfeld 2010-05-16 18:42:33 +00:00
parent 31fa5a1e1d
commit f827867a22
1 changed files with 5 additions and 1 deletions

View File

@ -673,6 +673,7 @@ efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name,
char *icon = NULL, *tmp = NULL;
Efreet_Icon_Theme_Directory *dir;
double minimal_size = INT_MAX;
unsigned int ret_size;
if (!theme || (theme->paths == NULL) || !icon_name || !size)
return NULL;
@ -699,7 +700,9 @@ efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name,
double distance;
distance = efreet_icon_directory_size_distance(dir, size);
if (distance >= minimal_size) continue;
if (distance > minimal_size) continue;
// prefer downsizing
if ((distance == minimal_size) && (size < ret_size)) continue;
tmp = efreet_icon_lookup_directory(theme, dir,
icon_name);
@ -708,6 +711,7 @@ efreet_icon_lookup_icon(Efreet_Icon_Theme *theme, const char *icon_name,
FREE(icon);
icon = tmp;
minimal_size = distance;
ret_size = size;
}
}