Hi,

The patch was slightly wrong: If you called togglemax() on a tiled
window, manually resized it (now floating), and then called togglemax()
twice, the window would now be tiled instead of floating. (This has to
be the most boring bug of all time.)

Fixed patch (now also in proper format) attached.

Regards,
Peter
diff -up dwm~/dwm.1 dwm/dwm.1
--- dwm~/dwm.1  2007-05-27 18:59:39.000000000 +0200
+++ dwm/dwm.1   2007-05-27 19:00:14.000000000 +0200
@@ -81,7 +81,7 @@ Increase master area width (tiled layout
 Decrease master area width (tiled layout only).
 .TP
 .B Mod1\-m
-Toggles maximization of current window (floating layout only).
+Toggles maximization of current window.
 .TP
 .B Mod1\-Shift\-[1..n]
 Apply
diff -up dwm~/dwm.h dwm/dwm.h
--- dwm~/dwm.h  2007-05-27 18:59:39.000000000 +0200
+++ dwm/dwm.h   2007-05-27 19:00:14.000000000 +0200
@@ -53,6 +53,7 @@ struct Client {
        long flags; 
        unsigned int border, oldborder;
        Bool isbanned, isfixed, ismax, isfloating;
+       Bool rtogglefloating; /* revert floating state */
        Bool *tags;
        Client *next;
        Client *prev;
Common subdirectories: dwm~/.hg and dwm/.hg
diff -up dwm~/layout.c dwm/layout.c
--- dwm~/layout.c       2007-05-27 18:59:39.000000000 +0200
+++ dwm/layout.c        2007-05-27 19:00:14.000000000 +0200
@@ -231,17 +231,26 @@ void
 togglemax(const char *arg) {
        XEvent ev;
 
-       if(!sel || (lt->arrange != floating && !sel->isfloating) || 
sel->isfixed)
+       if(!sel || sel->isfixed)
                return;
        if((sel->ismax = !sel->ismax)) {
+               if(lt->arrange != floating && !sel->isfloating) {
+                       togglefloating(NULL);
+                       sel->rtogglefloating = True;
+               }
+               else
+                       sel->rtogglefloating = False;
                sel->rx = sel->x;
                sel->ry = sel->y;
                sel->rw = sel->w;
                sel->rh = sel->h;
                resize(sel, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, 
True);
        }
-       else
+       else {
                resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
+               if (sel->rtogglefloating) 
+                       togglefloating(NULL);
+       }
        drawstatus();
        while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }

Reply via email to