removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles) f8181f64
Anselm R. Garbe · 2007-01-15 12:04 5 file(s) · +6 −30
client.c +3 −2
90 90
		sel = c;
91 91
		if(old) {
92 92
			grabbuttons(old, False);
93 -
			drawclient(old);
93 +
			XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
94 94
		}
95 95
	}
96 96
	if(c) {
98 98
		c->snext = stack;
99 99
		stack = c;
100 100
		grabbuttons(c, True);
101 -
		drawclient(c);
101 +
		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
102 102
		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
103 103
	}
104 104
	else
105 105
		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
106 +
	drawstatus();
106 107
}
107 108
108 109
Client *
draw.c +0 −20
98 98
/* extern */
99 99
100 100
void
101 -
drawall(void) {
102 -
	Client *c;
103 -
104 -
	for(c = clients; c; c = getnext(c->next))
105 -
		drawclient(c);
106 -
	drawstatus();
107 -
}
108 -
109 -
void
110 101
drawstatus(void) {
111 102
	int i, x;
112 103
134 125
		drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False);
135 126
	}
136 127
	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
137 -
	XSync(dpy, False);
138 -
}
139 -
140 -
void
141 -
drawclient(Client *c) {
142 -
	if(c == sel && issel) {
143 -
		drawstatus();
144 -
		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
145 -
		return;
146 -
	}
147 -
	XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
148 128
	XSync(dpy, False);
149 129
}
150 130
dwm.h +0 −2
117 117
extern void unmanage(Client *c);		/* destroy c */
118 118
119 119
/* draw.c */
120 -
extern void drawall(void);			/* draw all visible client titles and the bar */
121 120
extern void drawstatus(void);			/* draw the bar */
122 -
extern void drawclient(Client *c);		/* draw title and set border of c */
123 121
extern unsigned long getcolor(const char *colstr);	/* return color of colstr */
124 122
extern void setfont(const char *fontstr);	/* set the font for DC */
125 123
extern unsigned int textw(const char *text);	/* return the width of text in px*/
event.c +3 −5
235 235
	else if(ev->window == root) {
236 236
		issel = True;
237 237
		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
238 -
		drawall();
239 238
	}
240 239
}
241 240
272 271
leavenotify(XEvent *e) {
273 272
	XCrossingEvent *ev = &e->xcrossing;
274 273
275 -
	if((ev->window == root) && !ev->same_screen) {
274 +
	if((ev->window == root) && !ev->same_screen)
276 275
		issel = False;
277 -
		drawall();
278 -
	}
279 276
}
280 277
281 278
static void
329 326
		}
330 327
		if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
331 328
			updatetitle(c);
332 -
			drawclient(c);
329 +
			if(c == sel)
330 +
				drawstatus();
333 331
		}
334 332
	}
335 333
}
view.c +0 −1
200 200
			XLowerWindow(dpy, c->win);
201 201
		}
202 202
	}
203 -
	drawall();
204 203
	XSync(dpy, False);
205 204
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
206 205
}