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: Get complete state of a window. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v retrieving revision 1.123 retrieving revision 1.124 diff -u -3 -r1.123 -r1.124 --- Ecore_X.h 28 May 2005 17:06:51 -0000 1.123 +++ Ecore_X.h 29 May 2005 09:52:56 -0000 1.124 @@ -1219,6 +1219,8 @@ EAPI void ecore_x_netwm_user_time_set(Ecore_X_Window win, int time); EAPI int ecore_x_netwm_user_time_get(Ecore_X_Window win, int *time); +EAPI Ecore_X_Window_State *ecore_x_netwm_window_state_get(Ecore_X_Window win, int *num); + EAPI void ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State state, int on); EAPI int ecore_x_netwm_window_state_isset(Ecore_X_Window win, Ecore_X_Window_State state); EAPI void ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_netwm.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- ecore_x_netwm.c 16 May 2005 12:59:26 -0000 1.16 +++ ecore_x_netwm.c 29 May 2005 09:52:56 -0000 1.17 @@ -910,6 +910,36 @@ } } +Ecore_X_Window_State * +ecore_x_netwm_window_state_get(Ecore_X_Window win, int *num) +{ + int num_ret, i; + unsigned char *data; + Ecore_X_Atom *atoms; + Ecore_X_Window_State *state; + + if (num) *num = 0; + + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE, + XA_ATOM, 32, &data, &num_ret)) + return NULL; + + if ((!data) || (!num_ret)) return NULL; + + atoms = (Ecore_X_Atom *) data; + state = malloc(num_ret * sizeof(Ecore_X_Window_State)); + if (state) + { + for (i = 0; i < num_ret; ++i) + state[i] = _ecore_x_netwm_state_get(atoms[i]); + + if (num) *num = num_ret; + } + + XFree(data); + return state; +} + int ecore_x_netwm_window_state_isset(Ecore_X_Window win, Ecore_X_Window_State s) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -3 -r1.68 -r1.69 --- ecore_x_window_prop.c 28 May 2005 17:06:51 -0000 1.68 +++ ecore_x_window_prop.c 29 May 2005 09:52:56 -0000 1.69 @@ -1396,23 +1396,18 @@ Ecore_X_Atom *atoms; Atom *atom_ret; int num = 0, i; - + + if (num_ret) *num_ret = 0; + atom_ret = XListProperties(_ecore_x_disp, win, &num); - if (!atom_ret) - { - if (num_ret) *num_ret = 0; - return NULL; - } + if (!atom_ret) return NULL; + atoms = malloc(num * sizeof(Ecore_X_Atom)); if (atoms) { for (i = 0; i < num; i++) atoms[i] = atom_ret[i]; - XFree(atom_ret); if (num_ret) *num_ret = num; } - else - { - if (num_ret) *num_ret = 0; - } + XFree(atom_ret); return atoms; } ------------------------------------------------------- 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