maybe doc must be added here to say this api is from 1.2 (even if no
doc for other ecore_x functions.

related to this, maybe ticket #73 must be fixed too.

Vincent

On Tue, Feb 28, 2012 at 5:34 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> add ecore_x_netwm_icons_set()
>
>
>
> Author:       raster
> Date:         2012-02-27 20:34:10 -0800 (Mon, 27 Feb 2012)
> New Revision: 68487
> Trac:         http://trac.enlightenment.org/e/changeset/68487
>
> Modified:
>  trunk/ecore/ChangeLog trunk/ecore/src/lib/ecore_x/Ecore_X.h 
> trunk/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c 
> trunk/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
>
> Modified: trunk/ecore/ChangeLog
> ===================================================================
> --- trunk/ecore/ChangeLog       2012-02-28 04:25:37 UTC (rev 68486)
> +++ trunk/ecore/ChangeLog       2012-02-28 04:34:10 UTC (rev 68487)
> @@ -528,3 +528,7 @@
>
>         * Fix ecore_file_download to not limit downloads to 30sec.
>
> +2012-02-28 Carsten Haitzler (The Rasterman)
> +
> +        * Add ecore_x_netwm_icons_set()
> +
>
> Modified: trunk/ecore/src/lib/ecore_x/Ecore_X.h
> ===================================================================
> --- trunk/ecore/src/lib/ecore_x/Ecore_X.h       2012-02-28 04:25:37 UTC (rev 
> 68486)
> +++ trunk/ecore/src/lib/ecore_x/Ecore_X.h       2012-02-28 04:34:10 UTC (rev 
> 68487)
> @@ -2166,6 +2166,11 @@
>                                 int *bottom_start_x,
>                                 int *bottom_end_x);
>
> +EAPI void
> +ecore_x_netwm_icons_set(Ecore_X_Window win,
> +                        Ecore_X_Icon *icon,
> +                        int num);
> +
>  EAPI Eina_Bool
>  ecore_x_netwm_icons_get(Ecore_X_Window win,
>                         Ecore_X_Icon **icon,
>
> Modified: trunk/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c
> ===================================================================
> --- trunk/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c   2012-02-28 04:25:37 
> UTC (rev 68486)
> +++ trunk/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c   2012-02-28 04:34:10 
> UTC (rev 68487)
> @@ -838,6 +838,54 @@
>    ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name);
>  }
>
> +EAPI void
> +ecore_x_netwm_icons_set(Ecore_X_Window win,
> +                        Ecore_X_Icon *icon,
> +                        int num)
> +{
> +   unsigned int *data, *p, *p2;
> +   unsigned int i, size, x, y;
> +
> +   LOGFN(__FILE__, __LINE__, __FUNCTION__);
> +   size = 0;
> +   for (i = 0; i < (unsigned int)num; i++)
> +     {
> +        size += 2 + (icon[i].width * icon[i].height);
> +     }
> +   data = alloca(size * sizeof(unsigned int));
> +   p = data;
> +   for (i = 0; i < (unsigned int)num; i++)
> +     {
> +        p[0] = icon[i].width;
> +        p[1] = icon[i].height;
> +        p += 2;
> +        p2 = icon[i].data;
> +        for (y = 0; y < icon[i].height; y++)
> +          {
> +             for (x = 0; x < icon[i].width; x++)
> +               {
> +                  unsigned int r, g, b, a;
> +
> +                  a = (*p2 >> 24) & 0xff;
> +                  r = (*p2 >> 16) & 0xff;
> +                  g = (*p2 >> 8 ) & 0xff;
> +                  b = (*p2      ) & 0xff;
> +                  if ((a > 0) && (a < 255))
> +                    {
> +                       r = (r * 255) / a;
> +                       g = (g * 255) / a;
> +                       b = (b * 255) / a;
> +                    }
> +                  *p = (a << 24) | (r << 16) | (g << 8) | b;
> +                  p++;
> +                  p2++;
> +               }
> +          }
> +     }
> +   ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
> +                                  data, size);
> +}
> +
>  EAPI Eina_Bool
>  ecore_x_netwm_icons_get(Ecore_X_Window win,
>                         Ecore_X_Icon **icon,
>
> Modified: trunk/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
> ===================================================================
> --- trunk/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c    2012-02-28 04:25:37 
> UTC (rev 68486)
> +++ trunk/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c    2012-02-28 04:34:10 
> UTC (rev 68487)
> @@ -661,6 +661,55 @@
>    return EINA_TRUE;
>  }
>
> +EAPI void
> +ecore_x_netwm_icons_set(Ecore_X_Window win,
> +                        Ecore_X_Icon *icon,
> +                        int num)
> +{
> +   unsigned int *data, *p, *p2;
> +   unsigned int i, size, x, y;
> +
> +   LOGFN(__FILE__, __LINE__, __FUNCTION__);
> +   size = 0;
> +   for (i = 0; i < (unsigned int)num; i++)
> +     {
> +        size += 2 + (icon[i].width * icon[i].height);
> +     }
> +   data = alloca(size * sizeof(unsigned int));
> +   p = data;
> +   for (i = 0; i < (unsigned int)num; i++)
> +     {
> +        p[0] = icon[i].width;
> +        p[1] = icon[i].height;
> +        p += 2;
> +        p2 = icon[i].data;
> +        for (y = 0; y < icon[i].height; y++)
> +          {
> +             for (x = 0; x < icon[i].width; x++)
> +               {
> +                  unsigned int r, g, b, a;
> +
> +                  a = (*p2 >> 24) & 0xff;
> +                  r = (*p2 >> 16) & 0xff;
> +                  g = (*p2 >> 8 ) & 0xff;
> +                  b = (*p2      ) & 0xff;
> +                  if ((a > 0) && (a < 255))
> +                    {
> +                       // unpremul
> +                       r = (r * 255) / a;
> +                       g = (g * 255) / a;
> +                       b = (b * 255) / a;
> +                    }
> +                  *p = (a << 24) | (r << 16) | (g << 8) | b;
> +                  p++;
> +                  p2++;
> +               }
> +          }
> +     }
> +   ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
> +                                  data, size);
> +}
> +
>  EAPI Eina_Bool
>  ecore_x_netwm_icons_get(Ecore_X_Window win,
>                         Ecore_X_Icon **icon,
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to