forked from enlightenment/efl
* add ecore_x_atom_name_get() API (will be used by ewl)
* move atom related functions from ecore_x.c to ecore_x_atom.c SVN revision: 41283
This commit is contained in:
parent
3dfa5693f9
commit
3c7680e6cb
|
@ -1301,6 +1301,9 @@ EAPI void ecore_x_atom_get_prefetch(const char *name);
|
|||
EAPI void ecore_x_atom_get_fetch(void);
|
||||
EAPI Ecore_X_Atom ecore_x_atom_get(const char *name);
|
||||
EAPI void ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms);
|
||||
EAPI void ecore_x_get_atom_name_prefetch(Ecore_X_Atom atom);
|
||||
EAPI void ecore_x_get_atom_name_fetch(void);
|
||||
EAPI char *ecore_x_atom_name_get(Ecore_X_Atom atom);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -421,3 +421,63 @@ ecore_x_atom_get(const char *name __UNUSED__)
|
|||
|
||||
return reply->atom;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends the GetAtomName request.
|
||||
* @param atom Atom to get the name from.
|
||||
* @ingroup Ecore_X_Atom_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_x_get_atom_name_prefetch(Ecore_X_Atom atom)
|
||||
{
|
||||
xcb_get_atom_name_cookie_t cookie;
|
||||
|
||||
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom);
|
||||
_ecore_xcb_cookie_cache(cookie.sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reply of the GetAtomName request sent by ecore_x_get_atom_name_prefetch().
|
||||
* @ingroup Ecore_X_Atom_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_x_get_atom_name_fetch(void)
|
||||
{
|
||||
xcb_get_atom_name_cookie_t cookie;
|
||||
xcb_get_atom_name_reply_t *reply;
|
||||
|
||||
cookie.sequence = _ecore_xcb_cookie_get();
|
||||
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
_ecore_xcb_reply_cache(reply);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name of the given atom.
|
||||
* @param atom Unused.
|
||||
* @return The name of the atom.
|
||||
*
|
||||
* To use this function, you must call before, and in order,
|
||||
* ecore_x_get_atom_name_prefetch(), which sends the GetAtomName request,
|
||||
* then ecore_x_get_atom_name_fetch(), which gets the reply.
|
||||
* @ingroup Ecore_X_Atom_Group
|
||||
*/
|
||||
EAPI char *
|
||||
ecore_x_atom_name_get(Ecore_X_Atom atom)
|
||||
{
|
||||
xcb_get_atom_name_reply_t *reply;
|
||||
char *name;
|
||||
int length;
|
||||
|
||||
reply = _ecore_xcb_reply_get();
|
||||
if (!reply) return NULL;
|
||||
|
||||
length = xcb_get_atom_name_name_length(reply);
|
||||
name = (char *)malloc(sizeof(char) * (length + 1));
|
||||
if (!name) return NULL;
|
||||
|
||||
memcpy(name, xcb_get_atom_name_name(reply), length);
|
||||
name[length] = '\0';
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -1022,31 +1022,6 @@ ecore_x_window_client_sniff(Ecore_X_Window win)
|
|||
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the atom value associated with the given name.
|
||||
* @param name The given name.
|
||||
* @return Associated atom value.
|
||||
*/
|
||||
EAPI Ecore_X_Atom
|
||||
ecore_x_atom_get(const char *name)
|
||||
{
|
||||
if (!_ecore_x_disp) return 0;
|
||||
return XInternAtom(_ecore_x_disp, name, False);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
|
||||
{
|
||||
Atom *atoms_int;
|
||||
int i;
|
||||
|
||||
if (!_ecore_x_disp) return;
|
||||
atoms_int = alloca(num * sizeof(Atom));
|
||||
XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
|
||||
for (i = 0; i < num; i++)
|
||||
atoms[i] = atoms_int[i];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -223,3 +223,45 @@ _ecore_x_atoms_init(void)
|
|||
XInternAtoms(_ecore_x_disp, names, num, False, atoms);
|
||||
for (i = 0; i < num; i++) *(items[i].atom) = atoms[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the atom value associated with the given name.
|
||||
* @param name The given name.
|
||||
* @return Associated atom value.
|
||||
*/
|
||||
EAPI Ecore_X_Atom
|
||||
ecore_x_atom_get(const char *name)
|
||||
{
|
||||
if (!_ecore_x_disp) return 0;
|
||||
return XInternAtom(_ecore_x_disp, name, False);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
|
||||
{
|
||||
Atom *atoms_int;
|
||||
int i;
|
||||
|
||||
if (!_ecore_x_disp) return;
|
||||
atoms_int = alloca(num * sizeof(Atom));
|
||||
XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
|
||||
for (i = 0; i < num; i++)
|
||||
atoms[i] = atoms_int[i];
|
||||
}
|
||||
|
||||
EAPI char *
|
||||
ecore_x_atom_name_get(Ecore_X_Atom atom)
|
||||
{
|
||||
char *name;
|
||||
char *xname;
|
||||
|
||||
if (!_ecore_x_disp) return NULL;
|
||||
|
||||
xname = XGetAtomName(_ecore_x_disp, atom);
|
||||
if (!xname) return NULL;
|
||||
|
||||
name = strdup(xname);
|
||||
XFree(xname);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue