summaryrefslogtreecommitdiffstats
path: root/tag.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-22 11:42:08 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-22 11:42:08 +0100
commit2c477cf66147d369ae8ff17acdce743c6811ee6a (patch)
tree121a031caf30be9f6931e37e26cf2469c8c7acfa /tag.c
parentre-added xterm to config.default.h (diff)
downloaddwm-2c477cf66147d369ae8ff17acdce743c6811ee6a.tar.gz
dwm-2c477cf66147d369ae8ff17acdce743c6811ee6a.zip
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/tag.c b/tag.c
index d946309..a96cc62 100644
--- a/tag.c
+++ b/tag.c
@@ -102,49 +102,53 @@ settags(Client *c, Client *trans) {
102} 102}
103 103
104void 104void
105tag(Arg arg) { 105tag(const char *arg) {
106 unsigned int i; 106 int i;
107 107
108 if(!sel) 108 if(!sel)
109 return; 109 return;
110 for(i = 0; i < ntags; i++) 110 for(i = 0; i < ntags; i++)
111 sel->tags[i] = (arg.i == -1) ? True : False; 111 sel->tags[i] = arg ? False : True;
112 if(arg.i >= 0 && arg.i < ntags) 112 i = arg ? atoi(arg) : 0;
113 sel->tags[arg.i] = True; 113 if(i >= 0 && i < ntags)
114 sel->tags[i] = True;
114 lt->arrange(); 115 lt->arrange();
115} 116}
116 117
117void 118void
118toggletag(Arg arg) { 119toggletag(const char *arg) {
119 unsigned int i; 120 int i, j;
120 121
121 if(!sel) 122 if(!sel)
122 return; 123 return;
123 sel->tags[arg.i] = !sel->tags[arg.i]; 124 i = arg ? atoi(arg) : 0;
124 for(i = 0; i < ntags && !sel->tags[i]; i++); 125 sel->tags[i] = !sel->tags[i];
125 if(i == ntags) 126 for(j = 0; j < ntags && !sel->tags[j]; j++);
126 sel->tags[arg.i] = True; 127 if(j == ntags)
128 sel->tags[i] = True;
127 lt->arrange(); 129 lt->arrange();
128} 130}
129 131
130void 132void
131toggleview(Arg arg) { 133toggleview(const char *arg) {
132 unsigned int i; 134 int i, j;
133 135
134 seltag[arg.i] = !seltag[arg.i]; 136 i = arg ? atoi(arg) : 0;
135 for(i = 0; i < ntags && !seltag[i]; i++); 137 seltag[i] = !seltag[i];
136 if(i == ntags) 138 for(j = 0; j < ntags && !seltag[j]; i++);
137 seltag[arg.i] = True; /* cannot toggle last view */ 139 if(j == ntags)
140 seltag[i] = True; /* cannot toggle last view */
138 lt->arrange(); 141 lt->arrange();
139} 142}
140 143
141void 144void
142view(Arg arg) { 145view(const char *arg) {
143 unsigned int i; 146 int i;
144 147
145 for(i = 0; i < ntags; i++) 148 for(i = 0; i < ntags; i++)
146 seltag[i] = (arg.i == -1) ? True : False; 149 seltag[i] = arg ? False : True;
147 if(arg.i >= 0 && arg.i < ntags) 150 i = arg ? atoi(arg) : 0;
148 seltag[arg.i] = True; 151 if(i >= 0 && i < ntags)
152 seltag[i] = True;
149 lt->arrange(); 153 lt->arrange();
150} 154}