X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=dwm.c;h=3d9a0637bfe2ccc672b93e3d528d0011c7292f3f;hb=f529d41ca1792455bbae29e008af3c27c3a49df5;hp=e13571581b718c694461268bf020b82206bbff84;hpb=9bb0f20515023aa5471c628d01a6e65e93040dc1;p=dwm.git diff --git a/dwm.c b/dwm.c index e135715..3d9a063 100644 --- a/dwm.c +++ b/dwm.c @@ -459,16 +459,10 @@ destroynotify(XEvent *e) { void detach(Client *c) { - Client *i; + Client **tc; - if (c != clients) { - for(i = clients; i->next != c; i = i->next); - i->next = c->next; - } - else { - clients = c->next; - } - c->next = NULL; + for(tc = &clients; *tc && *tc != c; tc = &(*tc)->next); + *tc = c->next; } void @@ -1642,6 +1636,8 @@ updatewmhints(Client *c) { void view(const Arg *arg) { + if(arg && (arg->i & TAGMASK) == tagset[seltags]) + return; seltags ^= 1; /* toggle sel tagset */ if(arg && (arg->ui & TAGMASK)) tagset[seltags] = arg->i & TAGMASK;