Improve code of func "getatomprop"

This commit is contained in:
Alex Kotov 2021-11-20 22:04:23 +05:00
parent e8aa0dfb24
commit dfdd2b8a9e
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 24 additions and 7 deletions

View File

@ -639,16 +639,33 @@ void focusstack(const Arg *arg)
Atom getatomprop(Client *c, Atom prop) Atom getatomprop(Client *c, Atom prop)
{ {
int di; Atom atom = None;
unsigned long dl;
unsigned char *p = NULL;
Atom da, atom = None;
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM, Atom da = None;
&da, &di, &dl, &dl, &p) == Success && p) { int di = 0;
atom = *(Atom *)p; unsigned long dl = 0;
unsigned char *p = NULL;
if (
XGetWindowProperty(
dpy,
c->win,
prop,
0L,
sizeof(atom),
False,
XA_ATOM,
&da,
&di,
&dl,
&dl,
&p
) == Success && p
) {
atom = *(Atom*)p;
XFree(p); XFree(p);
} }
return atom; return atom;
} }