replaced isvisible with a macro cd3d83f5
Anselm R Garbe · 2008-05-22 14:15 1 file(s) · +12 −17
dwm.c +12 −17
52 52
#define MAXTAGLEN       16
53 53
#define MOUSEMASK       (BUTTONMASK|PointerMotionMask)
54 54
#define TAGMASK         ((int)((1LL << LENGTH(tags)) - 1))
55 +
#define VISIBLE(x)      ((x)->tags & tagset[seltags])
55 56
56 57
/* enums */
57 58
enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
149 150
Bool isoccupied(uint t);
150 151
Bool isprotodel(Client *c);
151 152
Bool isurgent(uint t);
152 -
Bool isvisible(Client *c);
153 153
void keypress(XEvent *e);
154 154
void killclient(const void *arg);
155 155
void manage(Window w, XWindowAttributes *wa);
267 267
	Client *c;
268 268
269 269
	for(c = clients; c; c = c->next)
270 -
		if(isvisible(c)) {
270 +
		if(VISIBLE(c)) {
271 271
			unban(c);
272 272
			if(!lt->arrange || c->isfloating)
273 273
				resize(c, c->x, c->y, c->w, c->h, True);
444 444
			if((ev->value_mask & (CWX|CWY))
445 445
			&& !(ev->value_mask & (CWWidth|CWHeight)))
446 446
				configure(c);
447 -
			if(isvisible(c))
447 +
			if(VISIBLE(c))
448 448
				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
449 449
		}
450 450
		else
497 497
	Client *c;
498 498
499 499
	dc.x = 0;
500 -
	for(c = stack; c && !isvisible(c); c = c->snext);
500 +
	for(c = stack; c && !VISIBLE(c); c = c->snext);
501 501
	for(i = 0; i < LENGTH(tags); i++) {
502 502
		dc.w = textw(tags[i]);
503 503
		if(tagset[seltags] & 1 << i) {
628 628
629 629
void
630 630
focus(Client *c) {
631 -
	if(!c || (c && !isvisible(c)))
632 -
		for(c = stack; c && !isvisible(c); c = c->snext);
631 +
	if(!c || (c && !VISIBLE(c)))
632 +
		for(c = stack; c && !VISIBLE(c); c = c->snext);
633 633
	if(sel && sel != c) {
634 634
		grabbuttons(sel, False);
635 635
		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
663 663
664 664
	if(!sel)
665 665
		return;
666 -
	for(c = sel->next; c && !isvisible(c); c = c->next);
666 +
	for(c = sel->next; c && !VISIBLE(c); c = c->next);
667 667
	if(!c)
668 -
		for(c = clients; c && !isvisible(c); c = c->next);
668 +
		for(c = clients; c && !VISIBLE(c); c = c->next);
669 669
	if(c) {
670 670
		focus(c);
671 671
		restack();
678 678
679 679
	if(!sel)
680 680
		return;
681 -
	for(c = sel->prev; c && !isvisible(c); c = c->prev);
681 +
	for(c = sel->prev; c && !VISIBLE(c); c = c->prev);
682 682
	if(!c) {
683 683
		for(c = clients; c && c->next; c = c->next);
684 -
		for(; c && !isvisible(c); c = c->prev);
684 +
		for(; c && !VISIBLE(c); c = c->prev);
685 685
	}
686 686
	if(c) {
687 687
		focus(c);
873 873
	return False;
874 874
}
875 875
876 -
Bool
877 -
isvisible(Client *c) {
878 -
	return c->tags & tagset[seltags];
879 -
}
880 -
881 876
void
882 877
keypress(XEvent *e) {
883 878
	uint i;
1043 1038
1044 1039
Client *
1045 1040
nexttiled(Client *c) {
1046 -
	for(; c && (c->isfloating || !isvisible(c)); c = c->next);
1041 +
	for(; c && (c->isfloating || !VISIBLE(c)); c = c->next);
1047 1042
	return c;
1048 1043
}
1049 1044
1207 1202
		wc.stack_mode = Below;
1208 1203
		wc.sibling = barwin;
1209 1204
		for(c = stack; c; c = c->snext)
1210 -
			if(!c->isfloating && isvisible(c)) {
1205 +
			if(!c->isfloating && VISIBLE(c)) {
1211 1206
				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
1212 1207
				wc.sibling = c->win;
1213 1208
			}