X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=client.c;h=af0190fbe7d9cbcd11e561ef0f4020bfe497bb0f;hb=d6a6eca71d760fb3b61e35b187b9b9fd51092c71;hp=cb5334e7a42df96b3734e39f6d725d8598addc35;hpb=2272df9d3179ec639066614f4d36d18df16ff725;p=dwm.git diff --git a/client.c b/client.c index cb5334e..af0190f 100644 --- a/client.c +++ b/client.c @@ -73,12 +73,14 @@ focus(Client *c) { Client *old = sel; - if (!issel) + if(!issel) return; - if(sel && sel->ismax && sel != c) - togglemax(NULL); - sel = c; - if(old && old != c) { + if(!sel) + sel = c; + else if(sel != c) { + if(sel->ismax) + togglemax(NULL); + sel = c; grabbutton(old, AnyButton, 0); drawtitle(old); } @@ -87,40 +89,6 @@ focus(Client *c) XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); } -void -focusnext(Arg *arg) -{ - Client *c; - - if(!sel) - return; - - if(!(c = getnext(sel->next))) - c = getnext(clients); - if(c) { - focus(c); - restack(); - } -} - -void -focusprev(Arg *arg) -{ - Client *c; - - if(!sel) - return; - - if(!(c = getprev(sel->prev))) { - for(c = clients; c && c->next; c = c->next); - c = getprev(c); - } - if(c) { - focus(c); - restack(); - } -} - Client * getclient(Window w) { @@ -212,6 +180,7 @@ killclient(Arg *arg) void manage(Window w, XWindowAttributes *wa) { + unsigned int i; Client *c, *tc; Window trans; XSetWindowAttributes twa; @@ -259,7 +228,11 @@ manage(Window w, XWindowAttributes *wa) grabbutton(c, Button2, MODKEY); grabbutton(c, Button3, MODKEY); - settags(c); + if((tc = getclient(trans))) /* inherit tags */ + for(i = 0; i < ntags; i++) + c->tags[i] = tc->tags[i]; + else + settags(c); if(!c->isfloat) c->isfloat = trans || (c->maxw && c->minw && @@ -439,30 +412,3 @@ unmanage(Client *c) focus(sel); arrange(NULL); } - -void -zoom(Arg *arg) -{ - Client *c; - - if(!sel || (arrange != dotile) || sel->isfloat || sel->ismax) - return; - - if(sel == getnext(clients)) { - if((c = getnext(sel->next))) - sel = c; - else - return; - } - - /* pop */ - sel->prev->next = sel->next; - if(sel->next) - sel->next->prev = sel->prev; - sel->prev = NULL; - clients->prev = sel; - sel->next = clients; - clients = sel; - focus(sel); - arrange(NULL); -}