JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
focus on view change as well
[dwm.git] / client.c
index e0ab719..029a59c 100644 (file)
--- a/client.c
+++ b/client.c
@@ -65,6 +65,9 @@ view(Arg *arg)
        tsel = arg->i;
        arrange(NULL);
 
+       if((c = next(clients)))
+               focus(c);
+
        for(c = clients; c; c = next(c->next))
                draw_client(c);
        draw_bar();
@@ -404,8 +407,6 @@ manage(Window w, XWindowAttributes *wa)
        c->next = *l; /* *l == nil */
        *l = c;
 
-       XMapRaised(dpy, c->win);
-       XMapRaised(dpy, c->title);
        XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
                        GrabModeAsync, GrabModeSync, None, None);
        XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
@@ -418,10 +419,17 @@ manage(Window w, XWindowAttributes *wa)
                        || ((c->maxw == c->minw) && (c->maxh == c->minh));
 
        arrange(NULL);
-       if(c->tags[tsel])
+       /* mapping the window now prevents flicker */
+       if(c->tags[tsel]) {
+               XMapRaised(dpy, c->win);
+               XMapRaised(dpy, c->title);
                focus(c);
-       else
+       }
+       else {
                ban_client(c);
+               XMapRaised(dpy, c->win);
+               XMapRaised(dpy, c->title);
+       }
 }
 
 void