X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=inline;f=client.c;h=fa486448432fd69eb1bc9547a16c739d23cf0652;hb=0aaa9a21f334a5c75b7efce2712384f57bd370cd;hp=69189dea1afb1b5c4e8f750c7447ceb52b1bb1b1;hpb=94f7c2707bcd11de4e0174abe0c2634980dc283e;p=dwm.git diff --git a/client.c b/client.c index 69189de..fa48644 100644 --- a/client.c +++ b/client.c @@ -66,8 +66,8 @@ focusnext(Arg *arg) if(!sel) return; - if(!(c = getnext(sel->next))) - c = getnext(clients); + if(!(c = getnext(sel->next, tsel))) + c = getnext(clients, tsel); if(c) { higher(c); c->revert = sel; @@ -267,6 +267,18 @@ maximize(Arg *arg) resize(sel, False); } +void +pop(Client *c) +{ + Client **l; + for(l = &clients; *l && *l != c; l = &(*l)->next); + *l = c->next; + + c->next = clients; /* pop */ + clients = c; + arrange(NULL); +} + void resize(Client *c, Bool inc) { @@ -405,21 +417,16 @@ unmanage(Client *c) void zoom(Arg *arg) { - Client **l, *c; + Client *c; if(!sel) return; - if(sel == getnext(clients) && sel->next) { - if((c = getnext(sel->next))) + if(sel == getnext(clients, tsel) && sel->next) { + if((c = getnext(sel->next, tsel))) sel = c; } - for(l = &clients; *l && *l != sel; l = &(*l)->next); - *l = sel->next; - - sel->next = clients; /* pop */ - clients = sel; - arrange(NULL); + pop(sel); focus(sel); }