comparison tag.c @ 261:d6fd632d861c

implement multi-tag selection through button3 click on the specific tag
author Anselm R.Garbe <arg@10ksloc.org>
date Fri, 11 Aug 2006 18:37:41 +0200
parents 87c5d5176e17
children d659a2dce2b5
comparison
equal deleted inserted replaced
260:243bf6783c7c 261:d6fd632d861c
49 { 49 {
50 Client *c; 50 Client *c;
51 51
52 for(c = clients; c; c = c->next) { 52 for(c = clients; c; c = c->next) {
53 c->ismax = False; 53 c->ismax = False;
54 if(c->tags[tsel]) { 54 if(isvisible(c)) {
55 resize(c, True, TopLeft); 55 resize(c, True, TopLeft);
56 } 56 }
57 else 57 else
58 ban(c); 58 ban(c);
59 } 59 }
72 int n, i, w, h; 72 int n, i, w, h;
73 Client *c; 73 Client *c;
74 74
75 w = sw - mw; 75 w = sw - mw;
76 for(n = 0, c = clients; c; c = c->next) 76 for(n = 0, c = clients; c; c = c->next)
77 if(c->tags[tsel] && !c->isfloat) 77 if(isvisible(c) && !c->isfloat)
78 n++; 78 n++;
79 79
80 if(n > 1) 80 if(n > 1)
81 h = (sh - bh) / (n - 1); 81 h = (sh - bh) / (n - 1);
82 else 82 else
83 h = sh - bh; 83 h = sh - bh;
84 84
85 for(i = 0, c = clients; c; c = c->next) { 85 for(i = 0, c = clients; c; c = c->next) {
86 c->ismax = False; 86 c->ismax = False;
87 if(c->tags[tsel]) { 87 if(isvisible(c)) {
88 if(c->isfloat) { 88 if(c->isfloat) {
89 higher(c); 89 higher(c);
90 resize(c, True, TopLeft); 90 resize(c, True, TopLeft);
91 continue; 91 continue;
92 } 92 }
133 } 133 }
134 134
135 Client * 135 Client *
136 getnext(Client *c) 136 getnext(Client *c)
137 { 137 {
138 for(; c && !c->tags[tsel]; c = c->next); 138 for(; c && !isvisible(c); c = c->next);
139 return c; 139 return c;
140 } 140 }
141 141
142 Client * 142 Client *
143 getprev(Client *c) 143 getprev(Client *c)
144 { 144 {
145 for(; c && !c->tags[tsel]; c = c->prev); 145 for(; c && !isvisible(c); c = c->prev);
146 return c; 146 return c;
147 } 147 }
148 148
149 void 149 void
150 initrregs() 150 initrregs()
171 free(reg); 171 free(reg);
172 else 172 else
173 rreg[i].tregex = reg; 173 rreg[i].tregex = reg;
174 } 174 }
175 } 175 }
176 }
177
178 Bool
179 isvisible(Client *c)
180 {
181 unsigned int i;
182
183 for(i = 0; i < ntags; i++)
184 if(c->tags[i] && tsel[i])
185 return True;
186 return False;
176 } 187 }
177 188
178 void 189 void
179 replacetag(Arg *arg) 190 replacetag(Arg *arg)
180 { 191 {
215 XFree(ch.res_class); 226 XFree(ch.res_class);
216 if(ch.res_name) 227 if(ch.res_name)
217 XFree(ch.res_name); 228 XFree(ch.res_name);
218 } 229 }
219 if(!matched) 230 if(!matched)
220 c->tags[tsel] = True; 231 for(i = 0; i < ntags; i++)
232 c->tags[i] = tsel[i];
221 } 233 }
222 234
223 void 235 void
224 togglemode(Arg *arg) 236 togglemode(Arg *arg)
225 { 237 {
228 } 240 }
229 241
230 void 242 void
231 view(Arg *arg) 243 view(Arg *arg)
232 { 244 {
233 tsel = arg->i; 245 unsigned int i;
246
247 for(i = 0; i < ntags; i++)
248 tsel[i] = False;
249 tsel[arg->i] = True;
234 arrange(NULL); 250 arrange(NULL);
235 drawall(); 251 drawall();
236 } 252 }
237 253
238 void 254 void
239 viewnext(Arg *arg) 255 viewnext(Arg *arg)
240 { 256 {
241 arg->i = (tsel < ntags-1) ? tsel+1 : 0; 257 unsigned int i;
258
259 for(i = 0; !tsel[i]; i++);
260 arg->i = (i < ntags-1) ? i+1 : 0;
242 view(arg); 261 view(arg);
243 } 262 }
244 263
245 void 264 void
246 viewprev(Arg *arg) 265 viewprev(Arg *arg)
247 { 266 {
248 arg->i = (tsel > 0) ? tsel-1 : ntags-1; 267 unsigned int i;
268
269 for(i = 0; !tsel[i]; i++);
270 arg->i = (i > 0) ? i-1 : ntags-1;
249 view(arg); 271 view(arg);
250 } 272 }