forked from enlightenment/efl
parent
60132f0727
commit
1bef88b19c
|
@ -528,3 +528,7 @@
|
||||||
|
|
||||||
* Fix ecore_file_download to not limit downloads to 30sec.
|
* Fix ecore_file_download to not limit downloads to 30sec.
|
||||||
|
|
||||||
|
2012-02-28 Carsten Haitzler (The Rasterman)
|
||||||
|
|
||||||
|
* Add ecore_x_netwm_icons_set()
|
||||||
|
|
||||||
|
|
|
@ -2166,6 +2166,11 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
|
||||||
int *bottom_start_x,
|
int *bottom_start_x,
|
||||||
int *bottom_end_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
|
EAPI Eina_Bool
|
||||||
ecore_x_netwm_icons_get(Ecore_X_Window win,
|
ecore_x_netwm_icons_get(Ecore_X_Window win,
|
||||||
Ecore_X_Icon **icon,
|
Ecore_X_Icon **icon,
|
||||||
|
|
|
@ -838,6 +838,54 @@ ecore_x_netwm_icon_name_set(Ecore_X_Window win,
|
||||||
ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name);
|
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
|
EAPI Eina_Bool
|
||||||
ecore_x_netwm_icons_get(Ecore_X_Window win,
|
ecore_x_netwm_icons_get(Ecore_X_Window win,
|
||||||
Ecore_X_Icon **icon,
|
Ecore_X_Icon **icon,
|
||||||
|
|
|
@ -661,6 +661,55 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
|
||||||
return EINA_TRUE;
|
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
|
EAPI Eina_Bool
|
||||||
ecore_x_netwm_icons_get(Ecore_X_Window win,
|
ecore_x_netwm_icons_get(Ecore_X_Window win,
|
||||||
Ecore_X_Icon **icon,
|
Ecore_X_Icon **icon,
|
||||||
|
|
Loading…
Reference in New Issue