Improve code of func "updatewmhints"

This commit is contained in:
Alex Kotov 2021-11-20 22:17:29 +05:00
parent 8d0b890b49
commit 9607443f71
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 15 additions and 12 deletions

View File

@ -1709,20 +1709,23 @@ void updatewindowtype(Client *c)
void updatewmhints(Client *c)
{
XWMHints *wmh;
XWMHints *wmh = XGetWMHints(dpy, c->win);
if (!wmh) return;
if ((wmh = XGetWMHints(dpy, c->win))) {
if (c == selmon->sel && wmh->flags & XUrgencyHint) {
wmh->flags &= ~XUrgencyHint;
XSetWMHints(dpy, c->win, wmh);
} else
c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
if (wmh->flags & InputHint)
c->neverfocus = !wmh->input;
else
c->neverfocus = 0;
XFree(wmh);
if (c == selmon->sel && wmh->flags & XUrgencyHint) {
wmh->flags &= ~XUrgencyHint;
XSetWMHints(dpy, c->win, wmh);
} else {
c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
}
if (wmh->flags & InputHint) {
c->neverfocus = !wmh->input;
} else {
c->neverfocus = 0;
}
XFree(wmh);
}
Client *wintoclient(Window w)