1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

Convert XInternAtom to XCB

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Uli Schlachter 2018-10-03 14:38:59 +02:00 committed by Yuxuan Shui
parent 2da0ecdf66
commit 7e71f46401

View file

@ -1696,12 +1696,30 @@ cxfree(void *data) {
XFree(data);
}
static inline void _Noreturn
die(const char *msg) {
puts(msg);
exit(1);
}
/**
* Wrapper of XInternAtom() for convenience.
*/
static inline Atom
static inline xcb_atom_t
get_atom(session_t *ps, const char *atom_name) {
return XInternAtom(ps->dpy, atom_name, False);
xcb_connection_t *c = XGetXCBConnection(ps->dpy);
xcb_intern_atom_reply_t *reply =
xcb_intern_atom_reply(c,
xcb_intern_atom(c, False, strlen(atom_name), atom_name),
NULL);
xcb_atom_t atom = XCB_NONE;
if (reply) {
atom = reply->atom;
free(reply);
} else
die("Failed to intern atoms, bail out");
return atom;
}
/**