tag.c
changeset 413 761d0cd6e504
parent 393 6786cd59468f
child 416 e689e540607a
equal deleted inserted replaced
412:d75ef63c6c24 413:761d0cd6e504
   104 			XFree(ch.res_name);
   104 			XFree(ch.res_name);
   105 	}
   105 	}
   106 	if(!matched)
   106 	if(!matched)
   107 		for(i = 0; i < ntags; i++)
   107 		for(i = 0; i < ntags; i++)
   108 			c->tags[i] = seltag[i];
   108 			c->tags[i] = seltag[i];
   109 	for(i = 0; i < ntags && !c->tags[i]; i++);
   109 	for(c->weight = 0; c->weight < ntags && !c->tags[c->weight]; c->weight++);
   110 	c->weight = i;
       
   111 }
   110 }
   112 
   111 
   113 void
   112 void
   114 tag(Arg *arg)
   113 tag(Arg *arg)
   115 {
   114 {
   119 		return;
   118 		return;
   120 
   119 
   121 	for(i = 0; i < ntags; i++)
   120 	for(i = 0; i < ntags; i++)
   122 		sel->tags[i] = False;
   121 		sel->tags[i] = False;
   123 	sel->tags[arg->i] = True;
   122 	sel->tags[arg->i] = True;
       
   123 	sel->weight = arg->i;
   124 	arrange(NULL);
   124 	arrange(NULL);
   125 }
   125 }
   126 
   126 
   127 void
   127 void
   128 toggletag(Arg *arg)
   128 toggletag(Arg *arg)
   134 
   134 
   135 	sel->tags[arg->i] = !sel->tags[arg->i];
   135 	sel->tags[arg->i] = !sel->tags[arg->i];
   136 	for(i = 0; i < ntags && !sel->tags[i]; i++);
   136 	for(i = 0; i < ntags && !sel->tags[i]; i++);
   137 	if(i == ntags)
   137 	if(i == ntags)
   138 		sel->tags[arg->i] = True;
   138 		sel->tags[arg->i] = True;
       
   139 	for(sel->weight = 0; sel->weight < ntags && !sel->tags[sel->weight]; sel->weight++);
   139 	arrange(NULL);
   140 	arrange(NULL);
   140 }
   141 }