_NET_WM_ICON

SVN revision: 15067
This commit is contained in:
sebastid 2005-06-02 20:14:13 +00:00 committed by sebastid
parent 9398e011ff
commit 639bde5915
3 changed files with 52 additions and 10 deletions

View File

@ -1205,6 +1205,7 @@ EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win, int left, i
EAPI int ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom);
EAPI void ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right, int top, int bottom, int left_start_y, int left_end_y, int right_start_y, int right_end_y, int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x);
EAPI int ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom, int *left_start_y, int *left_end_y, int *right_start_y, int *right_end_y, int *top_start_x, int *top_end_x, int *bottom_start_x, int *bottom_end_x);
EAPI int ecore_x_netwm_icon_get(Ecore_X_Window win, int *width, int *height, unsigned int **data, int *num);
EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height);
EAPI int ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height);
#if 0

View File

@ -756,6 +756,45 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right,
return 1;
}
/* FIXME: safe to use unsigned int? Maybe uin32_t? */
int
ecore_x_netwm_icon_get(Ecore_X_Window win, int *width, int *height, unsigned int **data, int *num)
{
unsigned char *data_ret, *src, *dst;
int num_ret, pos, len;
if (width) *width = 0;
if (height) *height = 0;
if (num) *num = 0;
if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_ICON,
XA_CARDINAL, 32, &data_ret, &num_ret))
return 0;
*data = malloc((num_ret - 2) * sizeof(unsigned int));
if (!(*data)) return 0;
if (num) *num = (num_ret - 2);
if (width) *width = ((unsigned int *)data_ret)[0];
if (height) *height = ((unsigned int *)data_ret)[1];
len = ((unsigned int *)data_ret)[0] * ((unsigned int *)data_ret)[1];
src = &(((unsigned int *)data_ret)[2]);
dst = *data;
for (pos = 0; pos < len; ++pos, src += 4, dst += 4)
{
/* FIXME: Hm, seems firefox does this wrong! */
dst[0] = src[0]; /* R */
dst[1] = src[1]; /* G */
dst[2] = src[2]; /* B */
dst[3] = src[3]; /* A */
}
free(data_ret);
return 1;
}
void
ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height)
{

View File

@ -89,18 +89,20 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecor
return 0;
}
for (i = 0; i < num_ret; i++)
switch (size) {
case 8:
switch (size) {
case 8:
for (i = 0; i < num_ret; i++)
(*data)[i] = prop_ret[i];
break;
case 16:
break;
case 16:
for (i = 0; i < num_ret; i++)
((uint16_t *) *data)[i] = ((uint16_t *) prop_ret)[i];
break;
case 32:
break;
case 32:
for (i = 0; i < num_ret; i++)
((uint32_t *) *data)[i] = ((uint32_t *) prop_ret)[i];
break;
}
break;
}
XFree(prop_ret);
@ -749,7 +751,7 @@ ecore_x_window_prop_sticky_set(Ecore_X_Window win, int on)
ecore_x_window_prop_state_unset(win, ECORE_X_WINDOW_STATE_STICKY);
ret = ecore_x_window_prop_property_get(0, ECORE_X_ATOM_NET_CURRENT_DESKTOP,
XA_CARDINAL, 32, &data, &num);
XA_CARDINAL, 32, &data, &num);
if (!ret || !num)
return;