X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/d4b7a9a3735deeab639f28b5bb2f568e0dc49616..dfa5ea63600d8c68bbe05fbc80191bd3198510b2:/client.c?ds=sidebyside 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