X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=14edf7c3ac71b4aefac8f1bcba6c436320ca2afa;hb=442334641e4124d8c32387287d431a83761ff916;hp=ecfd8f0eaed7d36e535f6cf58740103f8afd51d9;hpb=d4b7a9a3735deeab639f28b5bb2f568e0dc49616;p=dwm.git diff --git a/client.c b/client.c index ecfd8f0..14edf7c 100644 --- a/client.c +++ b/client.c @@ -49,11 +49,12 @@ ban(Client *c) void focus(Client *c) { - if (!issel) - return; Client *old = sel; - XEvent ev; + if (!issel) + return; + if(sel && sel->ismax) + togglemax(NULL); sel = c; if(old && old != c) drawtitle(old); @@ -69,9 +70,6 @@ focusnext(Arg *arg) if(!sel) return; - if(sel->ismax) - togglemax(NULL); - if(!(c = getnext(sel->next))) c = getnext(clients); if(c) { @@ -88,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); @@ -263,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