reorganized
authorAnselm R. Garbe <arg@suckless.org>
Mon, 08 Jan 2007 17:36:56 +0100
changeset 675 1438e35b622e
parent 674 5d79c351e30a
child 676 7672a1041218
reorganized
dwm.h
main.c
view.c
--- a/dwm.h	Mon Jan 08 17:33:24 2007 +0100
+++ b/dwm.h	Mon Jan 08 17:36:56 2007 +0100
@@ -168,5 +168,6 @@
 extern void togglefloat(Arg *arg);		/* toggles focusesd client between floating/non-floating state */
 extern void togglemode(Arg *arg);		/* toggles global arrange function (dotile/dofloat) */
 extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */
+extern void updatemodetext(void);		/* updates mtext */
 extern void view(Arg *arg);			/* views the tag with arg's index */
 extern void zoom(Arg *arg);			/* zooms the focused client to master area, arg is ignored */
--- a/main.c	Mon Jan 08 17:33:24 2007 +0100
+++ b/main.c	Mon Jan 08 17:36:56 2007 +0100
@@ -133,8 +133,7 @@
 	sh = DisplayHeight(dpy, screen);
 	master = MASTER;
 	nmaster = NMASTER;
-	snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
-	bmw = textw(mtext);
+	updatemodetext();
 	/* bar */
 	bx = sx;
 	by = sy;
--- a/view.c	Mon Jan 08 17:33:24 2007 +0100
+++ b/view.c	Mon Jan 08 17:36:56 2007 +0100
@@ -153,8 +153,7 @@
 	if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
 		return;
 	nmaster += arg->i;
-	snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
-	bmw = textw(mtext);
+	updatemodetext();
 	if(sel)
 		arrange();
 	else
@@ -224,8 +223,7 @@
 void
 togglemode(Arg *arg) {
 	arrange = (arrange == dofloat) ? dotile : dofloat;
-	snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
-	bmw = textw(mtext);
+	updatemodetext();
 	if(sel)
 		arrange();
 	else
@@ -244,6 +242,12 @@
 }
 
 void
+updatemodetext() {
+	snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
+	bmw = textw(mtext);
+}
+
+void
 view(Arg *arg) {
 	unsigned int i;