about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--dwm.12
-rw-r--r--dwm.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/dwm.1 b/dwm.1
index c72bb7b..a79b92b 100644
--- a/dwm.1
+++ b/dwm.1
@@ -75,7 +75,7 @@ Focus previous window.
 Increases the master area width about 5% (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 --git a/dwm.c b/dwm.c
index 726e797..36ca4eb 100644
--- a/dwm.c
+++ b/dwm.c
@@ -64,7 +64,7 @@ struct Client {
 	int minax, maxax, minay, maxay;
 	long flags; 
 	unsigned int border, oldborder;
-	Bool isbanned, isfixed, ismax, isfloating;
+	Bool isbanned, isfixed, ismax, isfloating, wasfloating;
 	Bool *tags;
 	Client *next;
 	Client *prev;
@@ -1627,17 +1627,26 @@ void
 togglemax(const char *arg) {
 	XEvent ev;
 
-	if(!sel || (!isarrange(floating) && !sel->isfloating) || sel->isfixed)
+	if(!sel || sel->isfixed)
 		return;
 	if((sel->ismax = !sel->ismax)) {
+		if(isarrange(floating) || sel->isfloating)
+			sel->wasfloating = True;
+		else {
+			togglefloating(NULL);
+			sel->wasfloating = False;
+		}
 		sel->rx = sel->x;
 		sel->ry = sel->y;
 		sel->rw = sel->w;
 		sel->rh = sel->h;
 		resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
 	}
-	else
+	else {
 		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
+		if (!sel->wasfloating)
+			togglefloating(NULL);
+	}
 	drawbar();
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206