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);
+
EAPI void ecore_x_icccm_init(void);
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;
+}
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];
-}
-
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;
+}