JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
unfocus on slow sloppy monitor focus
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index 0f946a6..2d44442 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -397,9 +397,10 @@ arrange(Monitor *m) {
                showhide(m->stack);
        else for(m = mons; m; m = m->next)
                showhide(m->stack);
-       if(m)
+       if(m) {
                arrangemon(m);
-       else for(m = mons; m; m = m->next)
+               restack(m);
+       } else for(m = mons; m; m = m->next)
                arrangemon(m);
 }
 
@@ -408,7 +409,6 @@ arrangemon(Monitor *m) {
        strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
        if(m->lt[m->sellt]->arrange)
                m->lt[m->sellt]->arrange(m);
-       restack(m);
 }
 
 void
@@ -1212,6 +1212,7 @@ motionnotify(XEvent *e) {
        if(ev->window != root)
                return;
        if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
+               unfocus(selmon->sel, True);
                selmon = m;
                focus(NULL);
        }
@@ -1420,6 +1421,8 @@ restack(Monitor *m) {
        drawbar(m);
        if(!m->sel)
                return;
+       if(m->sel->isfloating || !m->lt[m->sellt]->arrange)
+               XRaiseWindow(dpy, m->sel->win);
        if(m->lt[m->sellt]->arrange) {
                wc.stack_mode = Below;
                wc.sibling = m->barwin;