aewl

diff aewl.c @ 762:3f0b245732fc

changed terminology: "tag" is now "group"
author meillo@marmaro.de
date Fri, 05 Dec 2008 16:03:45 +0100
parents 59ce221b9a37
children 17428bca4a12
line diff
     1.1 --- a/aewl.c	Fri Dec 05 15:44:43 2008 +0100
     1.2 +++ b/aewl.c	Fri Dec 05 16:03:45 2008 +0100
     1.3 @@ -86,7 +86,7 @@
     1.4  	long flags;
     1.5  	unsigned int border;
     1.6  	Bool isfixed, isfloat, ismax;
     1.7 -	Bool tag;
     1.8 +	Bool group;
     1.9  	Client *next;
    1.10  	Client *prev;
    1.11  	Client *snext;
    1.12 @@ -95,7 +95,7 @@
    1.13  
    1.14  typedef struct {
    1.15  	const char *clpattern;
    1.16 -	int tag;
    1.17 +	int group;
    1.18  	Bool isfloat;
    1.19  } Rule;
    1.20  
    1.21 @@ -126,7 +126,7 @@
    1.22  void (*handler[LASTEvent])(XEvent *);	/* event handler */
    1.23  void (*arrange)(void);			/* arrange function, indicates mode  */
    1.24  Atom wmatom[WMLast], netatom[NetLast];
    1.25 -Bool running, selscreen, seltag;
    1.26 +Bool running, selscreen, selgroup;
    1.27  Client *clients, *sel, *stack;		/* global client list and stack */
    1.28  Cursor cursor[CurLast];
    1.29  DC dc;					/* global draw context */
    1.30 @@ -177,7 +177,7 @@
    1.31  /* tag.c */
    1.32  void initrregs(void);			/* initialize regexps of rules defined in config.h */
    1.33  Client *getnext(Client *c);		/* returns next visible client */
    1.34 -void settags(Client *c, Client *trans);	/* sets tags of c */
    1.35 +void setgroup(Client *c, Client *trans);	/* sets group of c */
    1.36  
    1.37  /* util.c */
    1.38  void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
    1.39 @@ -191,7 +191,7 @@
    1.40  void restack(void);			/* restores z layers of all clients */
    1.41  
    1.42  
    1.43 -void toggleview(void);			/* toggle the viewed tag */
    1.44 +void toggleview(void);			/* toggle the viewed group */
    1.45  void focusnext(void);		/* focuses next visible client  */
    1.46  void zoom(void);			/* zooms the focused client to master area */
    1.47  void killclient(void);		/* kill c nicely */
    1.48 @@ -200,7 +200,7 @@
    1.49  void togglefloat(void);		/* toggles focusesd client between floating/non-floating state */
    1.50  void incnmaster(void);		/* increments nmaster */
    1.51  void decnmaster(void);		/* decrements nmaster */
    1.52 -void toggletag(void);		/* toggles c tag */
    1.53 +void togglegroup(void);		/* toggles c group */
    1.54  void spawn(const char* cmd);			/* forks a new subprocess with cmd */
    1.55  
    1.56  
    1.57 @@ -388,10 +388,7 @@
    1.58  
    1.59  Bool
    1.60  isvisible(Client *c) {
    1.61 -	if(c->tag == seltag) {
    1.62 -		return True;
    1.63 -	}
    1.64 -	return False;
    1.65 +	return (c->group == selgroup);
    1.66  }
    1.67  
    1.68  void
    1.69 @@ -447,7 +444,7 @@
    1.70  
    1.71  void
    1.72  toggleview() {
    1.73 -	seltag = !seltag;
    1.74 +	selgroup = !selgroup;
    1.75  	arrange();
    1.76  }
    1.77  
    1.78 @@ -581,15 +578,15 @@
    1.79  }
    1.80  
    1.81  void
    1.82 -settags(Client *c, Client *trans) {
    1.83 +setgroup(Client *c, Client *trans) {
    1.84  	char prop[512];
    1.85  	unsigned int i;
    1.86  	regmatch_t tmp;
    1.87 -	Bool matched = trans != NULL;
    1.88 +	Bool matched = (trans != NULL);
    1.89  	XClassHint ch = { 0 };
    1.90  
    1.91  	if(matched) {
    1.92 -		c->tag = trans->tag;
    1.93 +		c->group = trans->group;
    1.94  	} else {
    1.95  		XGetClassHint(dpy, c->win, &ch);
    1.96  		snprintf(prop, sizeof prop, "%s:%s:%s",
    1.97 @@ -598,12 +595,12 @@
    1.98  		for(i = 0; i < len; i++)
    1.99  			if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
   1.100  				c->isfloat = rule[i].isfloat;
   1.101 -				if (rule[i].tag < 0) {
   1.102 -					c->tag = seltag;
   1.103 -				} else if (rule[i].tag == 0) {
   1.104 -					c->tag = True;
   1.105 +				if (rule[i].group < 0) {
   1.106 +					c->group = selgroup;
   1.107 +				} else if (rule[i].group == 0) {
   1.108 +					c->group = True;
   1.109  				} else {
   1.110 -					c->tag = False;
   1.111 +					c->group = False;
   1.112  				}
   1.113  				matched = True;
   1.114          break;  /* perform only the first rule matching */
   1.115 @@ -614,15 +611,15 @@
   1.116  			XFree(ch.res_name);
   1.117  	}
   1.118  	if(!matched) {
   1.119 -		c->tag = seltag;
   1.120 +		c->group = selgroup;
   1.121  	}
   1.122  }
   1.123  
   1.124  void
   1.125 -toggletag() {
   1.126 +togglegroup() {
   1.127  	if(!sel)
   1.128  		return;
   1.129 -	sel->tag = !sel->tag;
   1.130 +	sel->group = !sel->group;
   1.131  	toggleview();
   1.132  }
   1.133  
   1.134 @@ -1054,10 +1051,10 @@
   1.135  
   1.136  	dc.x = dc.y = 0;
   1.137  	dc.w = textw(NAMESEL);
   1.138 -	drawtext(NAMESEL, ( seltag ? dc.sel : dc.norm ));
   1.139 +	drawtext(NAMESEL, ( selgroup ? dc.sel : dc.norm ));
   1.140  	dc.x += dc.w + 1;
   1.141  	dc.w = textw(NAMENSEL);
   1.142 -	drawtext(NAMENSEL, ( seltag ? dc.norm : dc.sel ));
   1.143 +	drawtext(NAMENSEL, ( selgroup ? dc.norm : dc.sel ));
   1.144  	dc.x += dc.w + 1;
   1.145  	dc.w = bmw;
   1.146  	drawtext("", dc.norm);
   1.147 @@ -1289,7 +1286,7 @@
   1.148  	Window trans;
   1.149  
   1.150  	c = emallocz(sizeof(Client));
   1.151 -	c->tag = True;
   1.152 +	c->group = True;
   1.153  	c->win = w;
   1.154  	c->x = wa->x;
   1.155  	c->y = wa->y;
   1.156 @@ -1317,7 +1314,7 @@
   1.157  	grabbuttons(c, False);
   1.158  	XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
   1.159  	updatetitle(c);
   1.160 -	settags(c, getclient(trans));
   1.161 +	setgroup(c, getclient(trans));
   1.162  	if(!c->isfloat)
   1.163  		c->isfloat = trans || c->isfixed;
   1.164  	if(clients)
   1.165 @@ -1590,7 +1587,7 @@
   1.166  	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
   1.167  	grabkeys();
   1.168  	initrregs();
   1.169 -	seltag = True;
   1.170 +	selgroup = True;
   1.171  	/* style */
   1.172  	dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
   1.173  	dc.norm[ColBG] = getcolor(NORMBGCOLOR);