JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added Sander to LICENSE (since he has contributed/revised big portions)
[dwm.git] / client.c
index ecfd8f0..14edf7c 100644 (file)
--- 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