about summary refs log tree commit diff stats
path: root/tag.c
diff options
context:
space:
mode:
authorAnselm R.Garbe <arg@10ksloc.org>2006-08-14 16:59:18 +0200
committerAnselm R.Garbe <arg@10ksloc.org>2006-08-14 16:59:18 +0200
commit19da197f58bc005ad379d751f28f0a17cea3d3b8 (patch)
tree0b204bd49a35c7148107ef091ab26b1aeef1abde /tag.c
parent666fae97e67810089ffbddd019d655bc4f9f7838 (diff)
downloaddwm-19da197f58bc005ad379d751f28f0a17cea3d3b8.tar.gz
changed replacetag into toggletag
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c65
1 files changed, 36 insertions, 29 deletions
diff --git a/tag.c b/tag.c
index edf68c6..51407e3 100644
--- a/tag.c
+++ b/tag.c
@@ -35,16 +35,6 @@ void (*arrange)(Arg *) = DEFMODE;
 /* extern */
 
 void
-appendtag(Arg *arg)
-{
-	if(!sel)
-		return;
-
-	sel->tags[arg->i] = True;
-	settitle(sel);
-}
-
-void
 dofloat(Arg *arg)
 {
 	Client *c;
@@ -183,19 +173,6 @@ isvisible(Client *c)
 }
 
 void
-replacetag(Arg *arg)
-{
-	int i;
-
-	if(!sel)
-		return;
-
-	for(i = 0; i < ntags; i++)
-		sel->tags[i] = False;
-	appendtag(arg);
-}
-
-void
 restack()
 {
 	static unsigned int nwins = 0;
@@ -281,6 +258,20 @@ settags(Client *c)
 }
 
 void
+tag(Arg *arg)
+{
+	unsigned int i;
+
+	if(!sel)
+		return;
+
+	for(i = 0; i < ntags; i++)
+		sel->tags[i] = False;
+	sel->tags[arg->i] = True;
+	settitle(sel);
+}
+
+void
 togglemode(Arg *arg)
 {
 	arrange = arrange == dofloat ? dotile : dofloat;
@@ -288,24 +279,40 @@ togglemode(Arg *arg)
 }
 
 void
-view(Arg *arg)
+toggletag(Arg *arg)
 {
 	unsigned int i;
 
-	for(i = 0; i < ntags; i++)
-		seltag[i] = False;
-	seltag[arg->i] = True;
-	arrange(NULL);
+	if(!sel)
+		return;
+
+	sel->tags[arg->i] = !sel->tags[arg->i];
+	for(i = 0; i < ntags && !sel->tags[i]; i++);
+	if(i == ntags)
+		sel->tags[arg->i] = True;
+	settitle(sel);
 }
 
+
 void
 toggleview(Arg *arg)
 {
 	unsigned int i;
 
 	seltag[arg->i] = !seltag[arg->i];
-	for(i = 0; !seltag[i] && i < ntags; i++);
+	for(i = 0; i < ntags && !seltag[i]; i++);
 	if(i == ntags)
 		seltag[arg->i] = True; /* cannot toggle last view */
 	arrange(NULL);
 }
+
+void
+view(Arg *arg)
+{
+	unsigned int i;
+
+	for(i = 0; i < ntags; i++)
+		seltag[i] = False;
+	seltag[arg->i] = True;
+	arrange(NULL);
+}