JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied Andreas Amann fullscreen fix, some minor modifications
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index 0f946a6..10b0d0d 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);
        }
@@ -1260,8 +1261,11 @@ movemouse(const Arg *arg) {
                                && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
                                        togglefloating(NULL);
                        }
-                       if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
+                       if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) {
+                               if(c->isfullscreen)
+                                       setfullscreen(c, False);
                                resize(c, nx, ny, c->w, c->h, True);
+                       }
                        break;
                }
        } while(ev.type != ButtonRelease);
@@ -1396,8 +1400,11 @@ resizemouse(const Arg *arg) {
                                && (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
                                        togglefloating(NULL);
                        }
-                       if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
+                       if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) {
+                               if(c->isfullscreen)
+                                       setfullscreen(c, False);
                                resize(c, c->x, c->y, nw, nh, True);
+                       }
                        break;
                }
        } while(ev.type != ButtonRelease);
@@ -1420,6 +1427,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;
@@ -1741,6 +1750,8 @@ togglefloating(const Arg *arg) {
        if(selmon->sel->isfloating)
                resize(selmon->sel, selmon->sel->x, selmon->sel->y,
                       selmon->sel->w, selmon->sel->h, False);
+       else if(selmon->sel->isfullscreen)
+               setfullscreen(selmon->sel, False);
        arrange(selmon);
 }
 
@@ -2017,7 +2028,6 @@ updatewindowtype(Client *c) {
 
        if(state == netatom[NetWMFullscreen])
                setfullscreen(c, True);
-
        if(wtype == netatom[NetWMWindowTypeDialog])
                c->isfloating = True;
 }