Convert XGetAtomName to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
ca148c8f15
commit
b2bfbcdfb0
9
src/c2.c
9
src/c2.c
|
@ -1463,7 +1463,14 @@ c2_match_once_leaf(session_t *ps, win *w, const c2_l_t *pleaf,
|
||||||
idx, 1L, c2_get_atom_type(pleaf), pleaf->format);
|
idx, 1L, c2_get_atom_type(pleaf), pleaf->format);
|
||||||
Atom atom = winprop_get_int(prop);
|
Atom atom = winprop_get_int(prop);
|
||||||
if (atom) {
|
if (atom) {
|
||||||
tgt_free = XGetAtomName(ps->dpy, atom);
|
xcb_connection_t *c = XGetXCBConnection(ps->dpy);
|
||||||
|
xcb_get_atom_name_reply_t *reply =
|
||||||
|
xcb_get_atom_name_reply(c, xcb_get_atom_name(c, atom), NULL);
|
||||||
|
if (reply) {
|
||||||
|
tgt_free = strndup(
|
||||||
|
xcb_get_atom_name_name(reply), xcb_get_atom_name_name_length(reply));
|
||||||
|
free(reply);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tgt_free) {
|
if (tgt_free) {
|
||||||
tgt = tgt_free;
|
tgt = tgt_free;
|
||||||
|
|
|
@ -2840,9 +2840,17 @@ ev_property_notify(session_t *ps, xcb_property_notify_event_t *ev) {
|
||||||
#ifdef DEBUG_EVENTS
|
#ifdef DEBUG_EVENTS
|
||||||
{
|
{
|
||||||
// Print out changed atom
|
// Print out changed atom
|
||||||
char *name = XGetAtomName(ps->dpy, ev->atom);
|
xcb_get_atom_name_reply_t *reply =
|
||||||
printf_dbg(" { atom = %s }\n", name);
|
xcb_get_atom_name_reply(ps->c, xcb_get_atom_name(ps->c, ev->atom), NULL);
|
||||||
cxfree(name);
|
const char *name = "?";
|
||||||
|
int name_len = 1;
|
||||||
|
if (reply) {
|
||||||
|
name = xcb_get_atom_name_name(reply);
|
||||||
|
name_len = xcb_get_atom_name_name_length(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf_dbg(" { atom = %.*s }\n", name_len, name);
|
||||||
|
free(reply);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue