Get complete state of a window.

SVN revision: 15009
This commit is contained in:
sebastid 2005-05-29 09:52:56 +00:00 committed by sebastid
parent 6d1880bef5
commit 2227605773
3 changed files with 38 additions and 11 deletions

View File

@ -1219,6 +1219,8 @@ EAPI int ecore_x_netwm_handled_icons_get(Ecore_X_Window win);
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);

View File

@ -910,6 +910,36 @@ _ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
}
}
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)
{

View File

@ -1396,23 +1396,18 @@ ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret)
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;
}