"hicolor" algorithm clarification in Icon Theme Spec

Patryk Zawadzki patrys at pld-linux.org
Sun Dec 24 12:07:52 EET 2006


Dnia 24-12-2006, nie o godzinie 00:28 -0800, Octavio Alvarez Piza
napisał(a):
> Hi, everybody. I'm new to the list. My name is Octavio Alvarez and I'm
> developing a small app named Superkb, intended to make something fancy
> for Xorg.
> 
> I'm converting the lookup algorithm in the Icon Theme Specification to
> C code. I have noticed that the "hicolor" fallback theme will be
> looked up before a second parent, thus, having the wrong lookup
> priority.

Why are you rewriting this from scratch if all widget toolkits already
provide such functionality?

> One of the paragraphs that says so is:
> 
> "In order to have a place for third party applications to install
> their icons there should always exist a theme called 'hicolor' [1].
> The data for the hicolor theme is available for download at:
> http://www.freedesktop.org/software/icon-theme/. Implementations are
> required to look in the "hicolor" theme if an icon was not found in
> the current theme."
> 
> This makes a second parent theme to get ignored if an icon exists in
> "hicolor". Themes that use "hicolor" as a parent should explicitly say
> so in their Inherits key.

I think I know what you mean:

> Here is a patch for the lookup pseudocode.
> 
>  FindIcon(icon, size) {
>    filename = FindIconHelper(icon, size, user selected theme);
>    if filename != none
>      return filename
> +   filename = FindIconHelper(icon, size, "hicolor");
> +   if filename != none
> +     return filename
>    return LookupFallbackIcon (icon)
>  }
>  FindIconHelper(icon, size, theme) {
>    filename = LookupIcon (icon, size, theme)
>    if filename != none
>      return filename
> 
>    if theme has parents
>      parents = theme.parents
> -  else if theme != hicolor
> -    parents = [hicolor]
> 
>    for parent in parents {
>      filename = FindIconHelper (icon, size, parent)
>      if filename != none
>        return filename
>    }

The above call in the loop is recursive so it will always reach a
grand-grand-...-parent that has no more parents and thus fall back into
"hicolor" in the first step of the "for" loop.

>    return none
>  }
> 
> It is my understanding that implementations must not look in "hicolor"
> when looking into a parent theme. Instead, it should be checked right
> before unthemed icons.

And you are probably true.

-- 
Patryk Zawadzki <patrys at pld-linux.org>
PLD Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: To jest =?UTF-8?Q?cz=C4=99=C5=9B=C4=87?= listu
	podpisana cyfrowo
Url : http://lists.freedesktop.org/archives/xdg/attachments/20061224/6cb89894/attachment.pgp 


More information about the xdg mailing list