X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=client.c;h=14edf7c3ac71b4aefac8f1bcba6c436320ca2afa;hb=78b050c13c8ea660ed801c21bddd2957a2bc3f40;hp=8d5ea3064d20fd9600d5c5357c865391d6ed040f;hpb=2c0d1cc87bf084ed3f1cdb4be881fb4f64f5773a;p=dwm.git diff --git a/client.c b/client.c index 8d5ea30..14edf7c 100644 --- a/client.c +++ b/client.c @@ -49,10 +49,12 @@ ban(Client *c) void focus(Client *c) { - if (!issel) - return; Client *old = sel; + if (!issel) + return; + if(sel && sel->ismax) + togglemax(NULL); sel = c; if(old && old != c) drawtitle(old); @@ -68,9 +70,6 @@ focusnext(Arg *arg) if(!sel) return; - if(sel->ismax) - togglemax(NULL); - if(!(c = getnext(sel->next))) c = getnext(clients); if(c) { @@ -87,9 +86,6 @@ focusprev(Arg *arg) if(!sel) return; - if(sel->ismax) - togglemax(NULL); - if(!(c = getprev(sel->prev))) { for(c = clients; c && c->next; c = c->next); c = getprev(c); @@ -262,11 +258,13 @@ manage(Window w, XWindowAttributes *wa) c->maxw == c->minw && c->maxh == c->minh); settitle(c); + if(isvisible(c)) + sel = c; + arrange(NULL); XMapWindow(dpy, c->win); XMapWindow(dpy, c->title); if(isvisible(c)) focus(c); - arrange(NULL); } void