Browse Source

introduced ISTILE, which can be easily extended with other layout functions to allow reuse of setmwfact() and zoom()

Anselm R. Garbe 18 năm trước cách đây
mục cha
commit
8d1810c85b
2 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 4 3
      config.h
  2. 3 3
      dwm.c

+ 4 - 3
config.h

@@ -22,14 +22,15 @@ Rule rules[] = {
 };
 
 /* layout(s) */
+#define ISTILE			isarrange(tile)
+#define MWFACT			0.6	/* master width factor [0.1 .. 0.9] */
+#define RESIZEHINTS		True	/* False - respect size hints in tiled resizals */
+#define SNAP			32	/* snap pixel */
 Layout layouts[] = {
 	/* symbol		function */
 	{ "[]=",		tile }, /* first entry is default */
 	{ "><>",		floating },
 };
-#define RESIZEHINTS		True	/* False - respect size hints in tiled resizals */
-#define MWFACT			0.6	/* master width factor [0.1 .. 0.9] */
-#define SNAP			32	/* snap pixel */
 
 /* key definitions */
 #define MODKEY			Mod1Mask

+ 3 - 3
dwm.c

@@ -341,7 +341,7 @@ buttonpress(XEvent *e) {
 			movemouse(c);
 		}
 		else if(ev->button == Button2) {
-			if(isarrange(tile) && !c->isfixed && c->isfloating)
+			if(ISTILE && !c->isfixed && c->isfloating)
 				togglefloating(NULL);
 			else
 				zoom(NULL);
@@ -1398,7 +1398,7 @@ void
 setmwfact(const char *arg) {
 	double delta;
 
-	if(isarrange(floating))
+	if(!ISTILE)
 		return;
 	/* arg handling, manipulate mwfact */
 	if(arg == NULL)
@@ -1850,7 +1850,7 @@ void
 zoom(const char *arg) {
 	Client *c;
 
-	if(!sel || isarrange(floating) || sel->isfloating)
+	if(!sel || !ISTILE || sel->isfloating)
 		return;
 	if((c = sel) == nexttiled(clients))
 		if(!(c = nexttiled(c->next)))