Enlightenment CVS committal Author : sebastid Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: Ecore_X.h ecore_x_netwm.c ecore_x_window_prop.c Log Message: _NET_WM_ICON =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v retrieving revision 1.125 retrieving revision 1.126 diff -u -3 -r1.125 -r1.126 --- Ecore_X.h 31 May 2005 06:51:50 -0000 1.125 +++ Ecore_X.h 2 Jun 2005 20:14:13 -0000 1.126 @@ -1205,6 +1205,7 @@ 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 =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_netwm.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- ecore_x_netwm.c 31 May 2005 06:51:50 -0000 1.18 +++ ecore_x_netwm.c 2 Jun 2005 20:14:13 -0000 1.19 @@ -756,6 +756,45 @@ 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) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -3 -r1.69 -r1.70 --- ecore_x_window_prop.c 29 May 2005 09:52:56 -0000 1.69 +++ ecore_x_window_prop.c 2 Jun 2005 20:14:13 -0000 1.70 @@ -89,18 +89,20 @@ 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_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; ------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs