コード例 #1
0
ファイル: icon.c プロジェクト: harryhaaren/jwm
/** Load the icon for a client. */
void LoadIcon(ClientNode *np)
{

   IconPathNode *ip;

   Assert(np);

   SetIconSize();

   /* If client already has an icon, destroy it first. */
   DestroyIcon(np->icon);
   np->icon = NULL;

   /* Attempt to read _NET_WM_ICON for an icon */
   ReadNetWMIcon(np);
   if(np->icon) {
      return;
   }

   /* Attempt to find an icon for this program in the icon directory */
   if(np->instanceName) {
      for(ip = iconPaths; ip; ip = ip->next) {

#ifdef USE_PNG
         np->icon = LoadSuffixedIcon(ip->path, np->instanceName, ".png");
         if(np->icon) {
            return;
         }
#endif

#ifdef USE_XPM
         np->icon = LoadSuffixedIcon(ip->path, np->instanceName, ".xpm");
         if(np->icon) {
            return;
         }
#endif

#ifdef USE_JPEG
         np->icon = LoadSuffixedIcon(ip->path, np->instanceName, ".jpg");
         if(np->icon) {
            return;
         }
#endif

#ifdef USE_ICONS
         np->icon = LoadSuffixedIcon(ip->path, np->instanceName, ".xbm");
         if(np->icon) {
            return;
         }
#endif

      }
   }

   /* Load the default icon */
   np->icon = GetDefaultIcon();

}
コード例 #2
0
ファイル: icon.c プロジェクト: Miteam/jwm
/** Load the icon for a client. */
void LoadIcon(ClientNode *np)
{
   /* If client already has an icon, destroy it first. */
   DestroyIcon(np->icon);
   np->icon = NULL;

   /* Attempt to read _NET_WM_ICON for an icon. */
   np->icon = ReadNetWMIcon(np->window);
   if(np->icon) {
      return;
   }
   if(np->owner != None) {
      np->icon = ReadNetWMIcon(np->owner);
      if(np->icon) {
         return;
      }
   }

   /* Attempt to read an icon from XWMHints. */
   np->icon = ReadWMHintIcon(np->window);
   if(np->icon) {
      return;
   }
   if(np->owner != None) {
      np->icon = ReadNetWMIcon(np->owner);
      if(np->icon) {
         return;
      }
   }

   /* Attempt to read an icon based on the window name. */
   if(np->instanceName) {
      np->icon = LoadNamedIcon(np->instanceName, 1, 1);
      if(np->icon) {
         return;
      }
   }

   /* Load the default icon */
   np->icon = GetDefaultIcon();
}