X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=c9c299481659f24a56f1b2c04b4bc5394867374b;hp=bded0c5def4e8650b3f99468db1bdc726a391c44;hb=fda92f46aadb4a344e52f3c560a63c9733606e3e;hpb=ea8a4ca46a9577997e0a3f30e211c644477c6a00 diff --git a/dwm.c b/dwm.c index bded0c5..c9c2994 100644 --- a/dwm.c +++ b/dwm.c @@ -15,7 +15,7 @@ * * Each child of the root window is called a client, except windows which have * set the override_redirect flag. Clients are organized in a global - * doubly-linked client list, the focus history is remembered through a global + * linked client list, the focus history is remembered through a global * stack list. Each client contains a bit array to indicate the tags of a * client. * @@ -138,7 +138,7 @@ static void attachstack(Client *c); static void buttonpress(XEvent *e); static void checkotherwm(void); static void cleanup(void); -static void clearurgent(void); +static void clearurgent(Client *c); static void configure(Client *c); static void configurenotify(XEvent *e); static void configurerequest(XEvent *e); @@ -365,20 +365,15 @@ cleanup(void) { } void -clearurgent(void) { +clearurgent(Client *c) { XWMHints *wmh; - Client *c; - - for(c = clients; c; c = c->next) - if(ISVISIBLE(c) && c->isurgent) { - c->isurgent = False; - if (!(wmh = XGetWMHints(dpy, c->win))) - continue; - wmh->flags &= ~XUrgencyHint; - XSetWMHints(dpy, c->win, wmh); - XFree(wmh); - } + c->isurgent = False; + if(!(wmh = XGetWMHints(dpy, c->win))) + return; + wmh->flags &= ~XUrgencyHint; + XSetWMHints(dpy, c->win, wmh); + XFree(wmh); } void @@ -617,6 +612,8 @@ focus(Client *c) { XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); } if(c) { + if(c->isurgent) + clearurgent(c); detachstack(c); attachstack(c); grabbuttons(c, True); @@ -1455,14 +1452,8 @@ tile(void) { h = wh; for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { - if(i + 1 == n) { /* remainder */ - if(wy + wh - y < bh) - resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, False); - else - resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, resizehints); - } - else - resize(c, x, y, w - 2 * c->bw, h - 2 * c->bw, resizehints); + resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) + ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints); if(h != wh) y = c->y + HEIGHT(c); } @@ -1506,7 +1497,6 @@ toggleview(const Arg *arg) { if(mask) { tagset[seltags] = mask; - clearurgent(); arrange(); } } @@ -1661,7 +1651,7 @@ updatewmhints(Client *c) { XWMHints *wmh; if((wmh = XGetWMHints(dpy, c->win))) { - if(ISVISIBLE(c) && wmh->flags & XUrgencyHint) { + if(c == sel && wmh->flags & XUrgencyHint) { wmh->flags &= ~XUrgencyHint; XSetWMHints(dpy, c->win, wmh); } @@ -1679,7 +1669,6 @@ view(const Arg *arg) { seltags ^= 1; /* toggle sel tagset */ if(arg->ui & TAGMASK) tagset[seltags] = arg->ui & TAGMASK; - clearurgent(); arrange(); }