"hicolor" algorithm clarification in Icon Theme Spec

Octavio Alvarez Piza alvarezp at alvarezp.ods.org
Sun Dec 24 10:28:36 EET 2006


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.

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.

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
   }
   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.

Octavio.



More information about the xdg mailing list