Browse Source

renamed floating into swimming (this does not clash with C naming conventions and fits better the fish symbol) - also in man page

Anselm R. Garbe 18 years ago
parent
commit
cee56d3863
7 changed files with 96 additions and 96 deletions
  1. 4 4
      client.c
  2. 4 4
      config.arg.h
  3. 4 4
      config.default.h
  4. 10 10
      dwm.1
  5. 3 4
      dwm.h
  6. 4 4
      event.c
  7. 67 66
      screen.c

+ 4 - 4
client.c

@@ -253,8 +253,8 @@ manage(Window w, XWindowAttributes *wa) {
 	updatetitle(c);
 	updatetitle(c);
 	for(t = clients; t && t->win != trans; t = t->next);
 	for(t = clients; t && t->win != trans; t = t->next);
 	settags(c, t);
 	settags(c, t);
-	if(!c->isfloat)
-		c->isfloat = (t != NULL) || c->isfixed;
+	if(!c->swimming)
+		c->swimming = (t != NULL) || c->isfixed;
 	attach(c);
 	attach(c);
 	attachstack(c);
 	attachstack(c);
 	c->isbanned = True;
 	c->isbanned = True;
@@ -268,7 +268,7 @@ manage(Window w, XWindowAttributes *wa) {
 
 
 Client *
 Client *
 nexttiled(Client *c) {
 nexttiled(Client *c) {
-	for(; c && (c->isfloat || !isvisible(c)); c = c->next);
+	for(; c && (c->swimming || !isvisible(c)); c = c->next);
 	return c;
 	return c;
 }
 }
 
 
@@ -440,7 +440,7 @@ zoom(Arg *arg) {
 
 
 	if(!sel)
 	if(!sel)
 		return;
 		return;
-	if(sel->isfloat || (lt->arrange == dofloat)) {
+	if(sel->swimming || (lt->arrange == swim)) {
 		togglemax(sel);
 		togglemax(sel);
 		return;
 		return;
 	}
 	}

+ 4 - 4
config.arg.h

@@ -8,8 +8,8 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
 #define LAYOUTS \
 #define LAYOUTS \
 static Layout layout[] = { \
 static Layout layout[] = { \
 	/* symbol		function */ \
 	/* symbol		function */ \
-	{ "[]=",		dotile }, /* first entry is default */ \
-	{ "><>",		dofloat }, \
+	{ "[]=",		tile }, /* first entry is default */ \
+	{ "><>",		swim }, \
 };
 };
 
 
 #define BORDERPX		1
 #define BORDERPX		1
@@ -64,7 +64,7 @@ static Key key[] = { \
 	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
 	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
 	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
 	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
 	{ MODKEY,			XK_space,	togglelayout,	{ 0 } }, \
 	{ MODKEY,			XK_space,	togglelayout,	{ 0 } }, \
-	{ MODKEY|ShiftMask,		XK_space,	togglefloat,	{ 0 } }, \
+	{ MODKEY|ShiftMask,		XK_space,	toggleswimming,	{ 0 } }, \
 	{ MODKEY,			XK_0,		view,		{ .i = -1 } }, \
 	{ MODKEY,			XK_0,		view,		{ .i = -1 } }, \
 	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
 	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
 	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
 	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
@@ -89,7 +89,7 @@ static Key key[] = { \
 
 
 #define RULES \
 #define RULES \
 static Rule rule[] = { \
 static Rule rule[] = { \
-	/* class:instance:title regex	tags regex	isfloat */ \
+	/* class:instance:title regex	tags regex	swimming */ \
 	{ "Firefox",			"3",		False }, \
 	{ "Firefox",			"3",		False }, \
 	{ "Gimp",			NULL,		True }, \
 	{ "Gimp",			NULL,		True }, \
 	{ "MPlayer",			NULL,		True }, \
 	{ "MPlayer",			NULL,		True }, \

+ 4 - 4
config.default.h

@@ -8,8 +8,8 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
 #define LAYOUTS \
 #define LAYOUTS \
 Layout layout[] = { \
 Layout layout[] = { \
 	/* symbol		function */ \
 	/* symbol		function */ \
-	{ "[]=",		dotile }, /* first entry is default */ \
-	{ "><>",		dofloat }, \
+	{ "[]=",		tile }, /* first entry is default */ \
+	{ "><>",		swim }, \
 };
 };
 
 
 #define BORDERPX		1
 #define BORDERPX		1
@@ -59,7 +59,7 @@ static Key key[] = { \
 	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
 	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
 	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
 	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
 	{ MODKEY,			XK_space,	togglelayout,	{ 0 } }, \
 	{ MODKEY,			XK_space,	togglelayout,	{ 0 } }, \
-	{ MODKEY|ShiftMask,		XK_space,	togglefloat,	{ 0 } }, \
+	{ MODKEY|ShiftMask,		XK_space,	toggleswimming,	{ 0 } }, \
 	{ MODKEY,			XK_0,		view,		{ .i = -1 } }, \
 	{ MODKEY,			XK_0,		view,		{ .i = -1 } }, \
 	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
 	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
 	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
 	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
@@ -86,7 +86,7 @@ static Key key[] = { \
  * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
  * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
 #define RULES \
 #define RULES \
 static Rule rule[] = { \
 static Rule rule[] = { \
-	/* class:instance:title regex	tags regex	isfloat */ \
+	/* class:instance:title regex	tags regex	swimming */ \
 	{ "Gimp",			NULL,		True }, \
 	{ "Gimp",			NULL,		True }, \
 	{ "MPlayer",			NULL,		True }, \
 	{ "MPlayer",			NULL,		True }, \
 	{ "Acroread",			NULL,		True }, \
 	{ "Acroread",			NULL,		True }, \

+ 10 - 10
dwm.1

@@ -6,13 +6,13 @@ dwm \- dynamic window manager
 .RB [ \-v ]
 .RB [ \-v ]
 .SH DESCRIPTION
 .SH DESCRIPTION
 dwm is a dynamic window manager for X. It manages windows in tiling and
 dwm is a dynamic window manager for X. It manages windows in tiling and
-floating layouts. Either layout can be applied dynamically, optimizing the
+swimming layouts. Either layout can be applied dynamically, optimizing the
 environment for the application in use and the task performed.
 environment for the application in use and the task performed.
 .P
 .P
 In tiling layout windows are managed in a master and stacking area. The master
 In tiling layout windows are managed in a master and stacking area. The master
 area contains the windows which currently need most attention, whereas the
 area contains the windows which currently need most attention, whereas the
-stacking area contains all other windows. In floating layout windows can be
-resized and moved freely. Dialog windows are always managed floating,
+stacking area contains all other windows. In swimming layout windows can be
+resized and moved freely. Dialog windows are always managed swimming,
 regardless of the layout applied.
 regardless of the layout applied.
 .P
 .P
 Windows are grouped by tags. Each window can be tagged with one or multiple
 Windows are grouped by tags. Each window can be tagged with one or multiple
@@ -38,7 +38,7 @@ is read and displayed in the status text area.
 .TP
 .TP
 .B Button1
 .B Button1
 click on a tag label to display all windows with that tag, click on the layout
 click on a tag label to display all windows with that tag, click on the layout
-label toggles between tiling and floating layout.
+label toggles between tiling and swimming layout.
 .TP
 .TP
 .B Button3
 .B Button3
 click on a tag label adds/removes all windows with that tag to/from the view.
 click on a tag label adds/removes all windows with that tag to/from the view.
@@ -67,7 +67,7 @@ Focus next window.
 Focus previous window.
 Focus previous window.
 .TP
 .TP
 .B Mod1-Return
 .B Mod1-Return
-Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (floating layout).
+Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (swimming layout).
 .TP
 .TP
 .B Mod1-g
 .B Mod1-g
 Grow master area (tiling layout only).
 Grow master area (tiling layout only).
@@ -98,10 +98,10 @@ tag to/from current window.
 Close focused window.
 Close focused window.
 .TP
 .TP
 .B Mod1-space
 .B Mod1-space
-Toggle between tiling and floating layout (affects all windows).
+Toggle between tiling and swimming layout (affects all windows).
 .TP
 .TP
 .B Mod1-Shift-space
 .B Mod1-Shift-space
-Toggle focused window between floating and non-floating state (tiling layout only).
+Toggle focused window between swimming and non-swimming state (tiling layout only).
 .TP
 .TP
 .B Mod1-[1..n]
 .B Mod1-[1..n]
 View all windows with
 View all windows with
@@ -121,13 +121,13 @@ Quit dwm.
 .SS Mouse commands
 .SS Mouse commands
 .TP
 .TP
 .B Mod1-Button1
 .B Mod1-Button1
-Move current window while dragging (floating layout only).
+Move current window while dragging (swimming layout only).
 .TP
 .TP
 .B Mod1-Button2
 .B Mod1-Button2
-Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (floating layout).
+Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (swimming layout).
 .TP
 .TP
 .B Mod1-Button3
 .B Mod1-Button3
-Resize current window while dragging (floating layout only).
+Resize current window while dragging (swimming layout only).
 .SH CUSTOMIZATION
 .SH CUSTOMIZATION
 dwm is customized by creating a custom config.h and (re)compiling the source
 dwm is customized by creating a custom config.h and (re)compiling the source
 code. This keeps it fast, secure and simple.
 code. This keeps it fast, secure and simple.

+ 3 - 4
dwm.h

@@ -72,7 +72,7 @@ struct Client {
 	int minax, minay, maxax, maxay;
 	int minax, minay, maxax, maxay;
 	long flags; 
 	long flags; 
 	unsigned int border;
 	unsigned int border;
-	Bool isbanned, isfixed, isfloat, ismax;
+	Bool isbanned, isfixed, ismax, swimming;
 	Bool *tags;
 	Bool *tags;
 	Client *next;
 	Client *next;
 	Client *prev;
 	Client *prev;
@@ -129,16 +129,15 @@ extern int xerror(Display *dsply, XErrorEvent *ee);	/* dwm's X error handler */
 
 
 /* screen.c */
 /* screen.c */
 extern void compileregs(void);			/* initialize regexps of rules defined in config.h */
 extern void compileregs(void);			/* initialize regexps of rules defined in config.h */
-extern void dofloat(void);			/* arranges all windows floating */
-extern void dotile(void);			/* arranges all windows tiled */
 extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
 extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
 extern void initlayouts(void);			/* initialize layout array */
 extern void initlayouts(void);			/* initialize layout array */
 extern Bool isvisible(Client *c);		/* returns True if client is visible */
 extern Bool isvisible(Client *c);		/* returns True if client is visible */
 extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
 extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
 extern void restack(void);			/* restores z layers of all clients */
 extern void restack(void);			/* restores z layers of all clients */
 extern void settags(Client *c, Client *trans);	/* sets tags of c */
 extern void settags(Client *c, Client *trans);	/* sets tags of c */
+extern void swim(void);				/* arranges all windows swimming */
 extern void tag(Arg *arg);			/* tags c with arg's index */
 extern void tag(Arg *arg);			/* tags c with arg's index */
-extern void togglefloat(Arg *arg);		/* toggles focusesd client between floating/non-floating state */
+extern void toggleswimming(Arg *arg);		/* toggles focusesd client between swimming/and non-swimming state */
 extern void togglelayout(Arg *arg);		/* toggles layout */
 extern void togglelayout(Arg *arg);		/* toggles layout */
 extern void toggletag(Arg *arg);		/* toggles c tags with arg's index */
 extern void toggletag(Arg *arg);		/* toggles c tags with arg's index */
 extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */
 extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */

+ 4 - 4
event.c

@@ -156,14 +156,14 @@ buttonpress(XEvent *e) {
 		focus(c);
 		focus(c);
 		if(CLEANMASK(ev->state) != MODKEY)
 		if(CLEANMASK(ev->state) != MODKEY)
 			return;
 			return;
-		if(ev->button == Button1 && (lt->arrange == dofloat || c->isfloat)) {
+		if(ev->button == Button1 && (lt->arrange == swim || c->swimming)) {
 			restack();
 			restack();
 			movemouse(c);
 			movemouse(c);
 		}
 		}
 		else if(ev->button == Button2)
 		else if(ev->button == Button2)
 			zoom(NULL);
 			zoom(NULL);
 		else if(ev->button == Button3
 		else if(ev->button == Button3
-		&& (lt->arrange == dofloat || c->isfloat) && !c->isfixed)
+		&& (lt->arrange == swim || c->swimming) && !c->isfixed)
 		{
 		{
 			restack();
 			restack();
 			resizemouse(c);
 			resizemouse(c);
@@ -181,7 +181,7 @@ configurerequest(XEvent *e) {
 		c->ismax = False;
 		c->ismax = False;
 		if(ev->value_mask & CWBorderWidth)
 		if(ev->value_mask & CWBorderWidth)
 			c->border = ev->border_width;
 			c->border = ev->border_width;
-		if(c->isfixed || c->isfloat || (lt->arrange == dofloat)) {
+		if(c->isfixed || c->swimming || (lt->arrange == swim)) {
 			if(ev->value_mask & CWX)
 			if(ev->value_mask & CWX)
 				c->x = ev->x;
 				c->x = ev->x;
 			if(ev->value_mask & CWY)
 			if(ev->value_mask & CWY)
@@ -309,7 +309,7 @@ propertynotify(XEvent *e) {
 			default: break;
 			default: break;
 			case XA_WM_TRANSIENT_FOR:
 			case XA_WM_TRANSIENT_FOR:
 				XGetTransientForHint(dpy, c->win, &trans);
 				XGetTransientForHint(dpy, c->win, &trans);
-				if(!c->isfloat && (c->isfloat = (trans != 0)))
+				if(!c->swimming && (c->swimming = (getclient(trans) != NULL)))
 					lt->arrange();
 					lt->arrange();
 				break;
 				break;
 			case XA_WM_NORMAL_HINTS:
 			case XA_WM_NORMAL_HINTS:

+ 67 - 66
screen.c

@@ -19,7 +19,7 @@ Layout *lt = NULL;
 typedef struct {
 typedef struct {
 	const char *prop;
 	const char *prop;
 	const char *tags;
 	const char *tags;
-	Bool isfloat;
+	Bool swimming;
 } Rule;
 } Rule;
 
 
 typedef struct {
 typedef struct {
@@ -27,7 +27,6 @@ typedef struct {
 	regex_t *tagregex;
 	regex_t *tagregex;
 } Regs;
 } Regs;
 
 
-LAYOUTS
 TAGS
 TAGS
 RULES
 RULES
 
 
@@ -35,60 +34,8 @@ static Regs *regs = NULL;
 static unsigned int nrules = 0;
 static unsigned int nrules = 0;
 static unsigned int nlayouts = 0;
 static unsigned int nlayouts = 0;
 
 
-/* extern */
-
-void
-compileregs(void) {
-	unsigned int i;
-	regex_t *reg;
-
-	if(regs)
-		return;
-	nrules = sizeof rule / sizeof rule[0];
-	regs = emallocz(nrules * sizeof(Regs));
-	for(i = 0; i < nrules; i++) {
-		if(rule[i].prop) {
-			reg = emallocz(sizeof(regex_t));
-			if(regcomp(reg, rule[i].prop, REG_EXTENDED))
-				free(reg);
-			else
-				regs[i].propregex = reg;
-		}
-		if(rule[i].tags) {
-			reg = emallocz(sizeof(regex_t));
-			if(regcomp(reg, rule[i].tags, REG_EXTENDED))
-				free(reg);
-			else
-				regs[i].tagregex = reg;
-		}
-	}
-}
-
-void
-dofloat(void) {
-	Client *c;
-
-	for(c = clients; c; c = c->next) {
-		if(isvisible(c)) {
-			if(c->isbanned)
-				XMoveWindow(dpy, c->win, c->x, c->y);
-			c->isbanned = False;
-			resize(c, c->x, c->y, c->w, c->h, True);
-		}
-		else {
-			c->isbanned = True;
-			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
-		}
-	}
-	if(!sel || !isvisible(sel)) {
-		for(c = stack; c && !isvisible(c); c = c->snext);
-		focus(c);
-	}
-	restack();
-}
-
-void
-dotile(void) {
+static void
+tile(void) {
 	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
 	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
 	Client *c;
 	Client *c;
 
 
@@ -105,7 +52,7 @@ dotile(void) {
 			if(c->isbanned)
 			if(c->isbanned)
 				XMoveWindow(dpy, c->win, c->x, c->y);
 				XMoveWindow(dpy, c->win, c->x, c->y);
 			c->isbanned = False;
 			c->isbanned = False;
-			if(c->isfloat)
+			if(c->swimming)
 				continue;
 				continue;
 			c->ismax = False;
 			c->ismax = False;
 			nx = wax;
 			nx = wax;
@@ -139,9 +86,40 @@ dotile(void) {
 	restack();
 	restack();
 }
 }
 
 
+LAYOUTS
+
+/* extern */
+
+void
+compileregs(void) {
+	unsigned int i;
+	regex_t *reg;
+
+	if(regs)
+		return;
+	nrules = sizeof rule / sizeof rule[0];
+	regs = emallocz(nrules * sizeof(Regs));
+	for(i = 0; i < nrules; i++) {
+		if(rule[i].prop) {
+			reg = emallocz(sizeof(regex_t));
+			if(regcomp(reg, rule[i].prop, REG_EXTENDED))
+				free(reg);
+			else
+				regs[i].propregex = reg;
+		}
+		if(rule[i].tags) {
+			reg = emallocz(sizeof(regex_t));
+			if(regcomp(reg, rule[i].tags, REG_EXTENDED))
+				free(reg);
+			else
+				regs[i].tagregex = reg;
+		}
+	}
+}
+
 void
 void
 incnmaster(Arg *arg) {
 incnmaster(Arg *arg) {
-	if((lt->arrange == dofloat) || (nmaster + arg->i < 1)
+	if((lt->arrange != tile) || (nmaster + arg->i < 1)
 	|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
 	|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
 		return;
 		return;
 	nmaster += arg->i;
 	nmaster += arg->i;
@@ -176,7 +154,7 @@ isvisible(Client *c) {
 
 
 void
 void
 resizemaster(Arg *arg) {
 resizemaster(Arg *arg) {
-	if(lt->arrange != dotile)
+	if(lt->arrange != tile)
 		return;
 		return;
 	if(arg->i == 0)
 	if(arg->i == 0)
 		master = MASTER;
 		master = MASTER;
@@ -197,10 +175,10 @@ restack(void) {
 	drawstatus();
 	drawstatus();
 	if(!sel)
 	if(!sel)
 		return;
 		return;
-	if(sel->isfloat || lt->arrange == dofloat)
+	if(sel->swimming || lt->arrange == swim)
 		XRaiseWindow(dpy, sel->win);
 		XRaiseWindow(dpy, sel->win);
-	if(lt->arrange != dofloat) {
-		if(!sel->isfloat)
+	if(lt->arrange != swim) {
+		if(!sel->swimming)
 			XLowerWindow(dpy, sel->win);
 			XLowerWindow(dpy, sel->win);
 		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
 		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
 			if(c == sel)
 			if(c == sel)
@@ -230,7 +208,7 @@ settags(Client *c, Client *trans) {
 				ch.res_name ? ch.res_name : "", c->name);
 				ch.res_name ? ch.res_name : "", c->name);
 		for(i = 0; i < nrules; i++)
 		for(i = 0; i < nrules; i++)
 			if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
 			if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
-				c->isfloat = rule[i].isfloat;
+				c->swimming = rule[i].swimming;
 				for(j = 0; regs[i].tagregex && j < ntags; j++) {
 				for(j = 0; regs[i].tagregex && j < ntags; j++) {
 					if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
 					if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
 						matched = True;
 						matched = True;
@@ -248,6 +226,29 @@ settags(Client *c, Client *trans) {
 			c->tags[i] = seltag[i];
 			c->tags[i] = seltag[i];
 }
 }
 
 
+void
+swim(void) {
+	Client *c;
+
+	for(c = clients; c; c = c->next) {
+		if(isvisible(c)) {
+			if(c->isbanned)
+				XMoveWindow(dpy, c->win, c->x, c->y);
+			c->isbanned = False;
+			resize(c, c->x, c->y, c->w, c->h, True);
+		}
+		else {
+			c->isbanned = True;
+			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+		}
+	}
+	if(!sel || !isvisible(sel)) {
+		for(c = stack; c && !isvisible(c); c = c->snext);
+		focus(c);
+	}
+	restack();
+}
+
 void
 void
 tag(Arg *arg) {
 tag(Arg *arg) {
 	unsigned int i;
 	unsigned int i;
@@ -262,10 +263,10 @@ tag(Arg *arg) {
 }
 }
 
 
 void
 void
-togglefloat(Arg *arg) {
-	if(!sel || lt->arrange == dofloat)
+toggleswimming(Arg *arg) {
+	if(!sel || lt->arrange == swim)
 		return;
 		return;
-	sel->isfloat = !sel->isfloat;
+	sel->swimming = !sel->swimming;
 	lt->arrange();
 	lt->arrange();
 }
 }