Improve code of func "getatomprop"
This commit is contained in:
parent
e8aa0dfb24
commit
dfdd2b8a9e
31
src/dwm.c
31
src/dwm.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue