changed Client->tags and Rule->tags to be Bool (I'll also try to remove the TLast enum)
This commit is contained in:
		
							parent
							
								
									5d3fd3707b
								
							
						
					
					
						commit
						8cc7f3bace
					
				
							
								
								
									
										2
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								client.c
									
									
									
									
									
								
							| @ -18,7 +18,7 @@ resizetitle(Client *c) | |||||||
| 	c->tw = 0; | 	c->tw = 0; | ||||||
| 	for(i = 0; i < TLast; i++) | 	for(i = 0; i < TLast; i++) | ||||||
| 		if(c->tags[i]) | 		if(c->tags[i]) | ||||||
| 			c->tw += textw(c->tags[i]); | 			c->tw += textw(tags[i]); | ||||||
| 	c->tw += textw(c->name); | 	c->tw += textw(c->name); | ||||||
| 	if(c->tw > c->w) | 	if(c->tw > c->w) | ||||||
| 		c->tw = c->w + 2; | 		c->tw = c->w + 2; | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| 
 | 
 | ||||||
| enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | ||||||
| #define TAGS \ | #define TAGS \ | ||||||
| char *tags[TLast] = { \ | const char *tags[TLast] = { \ | ||||||
| 	[Tfnord] = "fnord", \ | 	[Tfnord] = "fnord", \ | ||||||
| 	[Tdev] = "dev", \ | 	[Tdev] = "dev", \ | ||||||
| 	[Tnet] = "net", \ | 	[Tnet] = "net", \ | ||||||
| @ -66,7 +66,7 @@ static Key key[] = { \ | |||||||
| #define RULES \ | #define RULES \ | ||||||
| static Rule rule[] = { \ | static Rule rule[] = { \ | ||||||
| 	/* class:instance	tags				isfloat */ \ | 	/* class:instance	tags				isfloat */ \ | ||||||
| 	{ "Firefox.*",		{ [Tnet] = "net" },		False }, \ | 	{ "Firefox.*",		{ [Tnet] = True },		False }, \ | ||||||
| 	{ "Gimp.*",		{ 0 },				True}, \ | 	{ "Gimp.*",		{ 0 },				True}, \ | ||||||
| 	{ "MPlayer.*",		{ 0 },				True}, \ | 	{ "MPlayer.*",		{ 0 },				True}, \ | ||||||
| 	{ "Acroread.*",		{ 0 },				True}, \ | 	{ "Acroread.*",		{ 0 },				True}, \ | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| 
 | 
 | ||||||
| enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | ||||||
| #define TAGS \ | #define TAGS \ | ||||||
| char *tags[TLast] = { \ | const char *tags[TLast] = { \ | ||||||
| 	[Tfnord] = "fnord", \ | 	[Tfnord] = "fnord", \ | ||||||
| 	[Tdev] = "dev", \ | 	[Tdev] = "dev", \ | ||||||
| 	[Tnet] = "net", \ | 	[Tnet] = "net", \ | ||||||
| @ -57,6 +57,6 @@ static Key key[] = { \ | |||||||
| #define RULES \ | #define RULES \ | ||||||
| static Rule rule[] = { \ | static Rule rule[] = { \ | ||||||
| 	/* class:instance	tags				isfloat */ \ | 	/* class:instance	tags				isfloat */ \ | ||||||
| 	{ "Firefox.*",		{ [Tnet] = "net" },		False }, \ | 	{ "Firefox.*",		{ [Tnet] = True },		False }, \ | ||||||
| 	{ "Gimp.*",		{ 0 },				True}, \ | 	{ "Gimp.*",		{ 0 },				True}, \ | ||||||
| }; | }; | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								draw.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								draw.c
									
									
									
									
									
								
							| @ -30,7 +30,7 @@ drawborder(void) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static unsigned int | static unsigned int | ||||||
| textnw(char *text, unsigned int len) | textnw(const char *text, unsigned int len) | ||||||
| { | { | ||||||
| 	XRectangle r; | 	XRectangle r; | ||||||
| 
 | 
 | ||||||
| @ -156,8 +156,8 @@ drawtitle(Client *c) | |||||||
| 	for(i = 0; i < TLast; i++) { | 	for(i = 0; i < TLast; i++) { | ||||||
| 		if(c->tags[i]) { | 		if(c->tags[i]) { | ||||||
| 			dc.x += dc.w; | 			dc.x += dc.w; | ||||||
| 			dc.w = textw(c->tags[i]); | 			dc.w = textw(tags[i]); | ||||||
| 			drawtext(c->tags[i], !istile, True); | 			drawtext(tags[i], !istile, True); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	dc.x += dc.w; | 	dc.x += dc.w; | ||||||
| @ -229,7 +229,7 @@ setfont(const char *fontstr) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| unsigned int | unsigned int | ||||||
| textw(char *text) | textw(const char *text) | ||||||
| { | { | ||||||
| 	return textnw(text, strlen(text)) + dc.font.height; | 	return textnw(text, strlen(text)) + dc.font.height; | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								dwm.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								dwm.h
									
									
									
									
									
								
							| @ -51,7 +51,6 @@ struct DC { /* draw context */ | |||||||
| 
 | 
 | ||||||
| struct Client { | struct Client { | ||||||
| 	char name[256]; | 	char name[256]; | ||||||
| 	char *tags[TLast]; |  | ||||||
| 	int proto; | 	int proto; | ||||||
| 	int x, y, w, h; | 	int x, y, w, h; | ||||||
| 	int tx, ty, tw, th; /* title */ | 	int tx, ty, tw, th; /* title */ | ||||||
| @ -61,13 +60,15 @@ struct Client { | |||||||
| 	unsigned int border; | 	unsigned int border; | ||||||
| 	Bool isfloat; | 	Bool isfloat; | ||||||
| 	Bool ismax; | 	Bool ismax; | ||||||
|  | 	Bool tags[TLast]; | ||||||
| 	Client *next; | 	Client *next; | ||||||
| 	Client *prev; | 	Client *prev; | ||||||
| 	Window win; | 	Window win; | ||||||
| 	Window title; | 	Window title; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| extern char *tags[TLast], stext[1024]; | extern const char *tags[TLast]; | ||||||
|  | extern char stext[1024]; | ||||||
| extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; | extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; | ||||||
| extern void (*handler[LASTEvent])(XEvent *); | extern void (*handler[LASTEvent])(XEvent *); | ||||||
| extern void (*arrange)(Arg *); | extern void (*arrange)(Arg *); | ||||||
| @ -104,7 +105,7 @@ extern void drawstatus(); | |||||||
| extern void drawtitle(Client *c); | extern void drawtitle(Client *c); | ||||||
| extern unsigned long getcolor(const char *colstr); | extern unsigned long getcolor(const char *colstr); | ||||||
| extern void setfont(const char *fontstr); | extern void setfont(const char *fontstr); | ||||||
| extern unsigned int textw(char *text); | extern unsigned int textw(const char *text); | ||||||
| 
 | 
 | ||||||
| /* event.c */ | /* event.c */ | ||||||
| extern void grabkeys(); | extern void grabkeys(); | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								tag.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								tag.c
									
									
									
									
									
								
							| @ -13,7 +13,7 @@ | |||||||
| 
 | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	const char *pattern; | 	const char *pattern; | ||||||
| 	char *tags[TLast]; | 	Bool tags[TLast]; | ||||||
| 	Bool isfloat; | 	Bool isfloat; | ||||||
| } Rule; | } Rule; | ||||||
| 
 | 
 | ||||||
| @ -30,7 +30,7 @@ appendtag(Arg *arg) | |||||||
| 	if(!sel) | 	if(!sel) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	sel->tags[arg->i] = tags[arg->i]; | 	sel->tags[arg->i] = True; | ||||||
| 	arrange(NULL); | 	arrange(NULL); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -146,7 +146,7 @@ replacetag(Arg *arg) | |||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	for(i = 0; i < TLast; i++) | 	for(i = 0; i < TLast; i++) | ||||||
| 		sel->tags[i] = NULL; | 		sel->tags[i] = False; | ||||||
| 	appendtag(arg); | 	appendtag(arg); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -171,7 +171,7 @@ settags(Client *c) | |||||||
| 					for(j = 0; j < TLast; j++) { | 					for(j = 0; j < TLast; j++) { | ||||||
| 						if(rule[i].tags[j]) | 						if(rule[i].tags[j]) | ||||||
| 							matched = True; | 							matched = True; | ||||||
| 						c->tags[j] = rule[i].tags[j]; | 						c->tags[j] = True; | ||||||
| 					} | 					} | ||||||
| 					c->isfloat = rule[i].isfloat; | 					c->isfloat = rule[i].isfloat; | ||||||
| 				} | 				} | ||||||
| @ -184,7 +184,7 @@ settags(Client *c) | |||||||
| 			XFree(ch.res_name); | 			XFree(ch.res_name); | ||||||
| 	} | 	} | ||||||
| 	if(!matched) | 	if(!matched) | ||||||
| 		c->tags[tsel] = tags[tsel]; | 		c->tags[tsel] = True; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 arg@10ksloc.org
						arg@10ksloc.org