Hi all,

I just wrote a small patch to dwm 4.4.1 called tomati (for
TOggleMAxTIled). It's purpose is to allow the use of the togglemax
function on tiled windows. I tested it a little and it seems to me
that it behave as it should be.

But as it is the first patch I submit, and not only for dwm, there may
be problems I didn't see. Of course feedbacks are really welcome.

And thanks again for this really great WM !

-- 
Julien

diff -r 795c26a59016 dwm.h
--- a/dwm.h	Sun Aug 26 12:54:20 2007 +0200
+++ b/dwm.h	Wed Sep 05 17:05:35 2007 +0200
@@ -50,7 +50,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;
diff -r 795c26a59016 screen.c
--- a/screen.c	Sun Aug 26 12:54:20 2007 +0200
+++ b/screen.c	Wed Sep 05 17:05:35 2007 +0200
@@ -295,18 +295,24 @@ void
 void
 togglemax(const char *arg) {
 	XEvent ev;
-
-	if(!sel || (!isfloating() && !sel->isfloating) || sel->isfixed)
+	if(!sel)
 		return;
 	if((sel->ismax = !sel->ismax)) {
+		sel->wasfloating = sel->isfloating;
+		sel->isfloating = True;
 		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
-		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
+	else {
+		if(sel->wasfloating)
+			resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
+		else 
+			sel->isfloating = False;
+	}
+	arrange();
 	drawstatus();
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }

Reply via email to