aewl

diff tag.c @ 93:c498da7520c7

added heretag command which allows to tag a client of a foreign tag with current tag
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 18 Jul 2006 11:38:31 +0200
parents 052fe7498930
children 6efe82c775c9
line diff
     1.1 --- a/tag.c	Tue Jul 18 08:18:54 2006 +0200
     1.2 +++ b/tag.c	Tue Jul 18 11:38:31 2006 +0200
     1.3 @@ -49,7 +49,7 @@
     1.4  			ban(c);
     1.5  	}
     1.6  	if(sel && !sel->tags[tsel]) {
     1.7 -		if((sel = getnext(clients))) {
     1.8 +		if((sel = getnext(clients, tsel))) {
     1.9  			higher(sel);
    1.10  			focus(sel);
    1.11  		}
    1.12 @@ -106,7 +106,7 @@
    1.13  			ban(c);
    1.14  	}
    1.15  	if(!sel || (sel && !sel->tags[tsel])) {
    1.16 -		if((sel = getnext(clients))) {
    1.17 +		if((sel = getnext(clients, tsel))) {
    1.18  			higher(sel);
    1.19  			focus(sel);
    1.20  		}
    1.21 @@ -115,13 +115,32 @@
    1.22  }
    1.23  
    1.24  Client *
    1.25 -getnext(Client *c)
    1.26 +getnext(Client *c, unsigned int t)
    1.27  {
    1.28 -	for(; c && !c->tags[tsel]; c = c->next);
    1.29 +	for(; c && !c->tags[t]; c = c->next);
    1.30  	return c;
    1.31  }
    1.32  
    1.33  void
    1.34 +heretag(Arg *arg)
    1.35 +{
    1.36 +	int i;
    1.37 +	Client *c;
    1.38 +
    1.39 +	if(arg->i == tsel)
    1.40 +		return;
    1.41 +
    1.42 +	if(!(c = getnext(clients, arg->i)))
    1.43 +		return;
    1.44 +
    1.45 +	for(i = 0; i < TLast; i++)
    1.46 +		c->tags[i] = NULL;
    1.47 +	c->tags[tsel] = tags[tsel];
    1.48 +	arrange(NULL);
    1.49 +	focus(c);
    1.50 +}
    1.51 +
    1.52 +void
    1.53  replacetag(Arg *arg)
    1.54  {
    1.55  	int i;