removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles)
authorAnselm R. Garbe <arg@suckless.org>
Mon, 15 Jan 2007 12:04:25 +0100
changeset 690 399f08187c27
parent 689 cbec08a54a15
child 691 5d7e363f889d
removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles)
client.c
draw.c
dwm.h
event.c
view.c
--- a/client.c	Sun Jan 14 22:37:34 2007 +0100
+++ b/client.c	Mon Jan 15 12:04:25 2007 +0100
@@ -90,7 +90,7 @@
 		sel = c;
 		if(old) {
 			grabbuttons(old, False);
-			drawclient(old);
+			XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
 		}
 	}
 	if(c) {
@@ -98,11 +98,12 @@
 		c->snext = stack;
 		stack = c;
 		grabbuttons(c, True);
-		drawclient(c);
+		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
 		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
 	}
 	else
 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+	drawstatus();
 }
 
 Client *
--- a/draw.c	Sun Jan 14 22:37:34 2007 +0100
+++ b/draw.c	Mon Jan 15 12:04:25 2007 +0100
@@ -98,15 +98,6 @@
 /* extern */
 
 void
-drawall(void) {
-	Client *c;
-
-	for(c = clients; c; c = getnext(c->next))
-		drawclient(c);
-	drawstatus();
-}
-
-void
 drawstatus(void) {
 	int i, x;
 
@@ -137,17 +128,6 @@
 	XSync(dpy, False);
 }
 
-void
-drawclient(Client *c) {
-	if(c == sel && issel) {
-		drawstatus();
-		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
-		return;
-	}
-	XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
-	XSync(dpy, False);
-}
-
 unsigned long
 getcolor(const char *colstr) {
 	Colormap cmap = DefaultColormap(dpy, screen);
--- a/dwm.h	Sun Jan 14 22:37:34 2007 +0100
+++ b/dwm.h	Mon Jan 15 12:04:25 2007 +0100
@@ -117,9 +117,7 @@
 extern void unmanage(Client *c);		/* destroy c */
 
 /* draw.c */
-extern void drawall(void);			/* draw all visible client titles and the bar */
 extern void drawstatus(void);			/* draw the bar */
-extern void drawclient(Client *c);		/* draw title and set border of c */
 extern unsigned long getcolor(const char *colstr);	/* return color of colstr */
 extern void setfont(const char *fontstr);	/* set the font for DC */
 extern unsigned int textw(const char *text);	/* return the width of text in px*/
--- a/event.c	Sun Jan 14 22:37:34 2007 +0100
+++ b/event.c	Mon Jan 15 12:04:25 2007 +0100
@@ -235,7 +235,6 @@
 	else if(ev->window == root) {
 		issel = True;
 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
-		drawall();
 	}
 }
 
@@ -272,10 +271,8 @@
 leavenotify(XEvent *e) {
 	XCrossingEvent *ev = &e->xcrossing;
 
-	if((ev->window == root) && !ev->same_screen) {
+	if((ev->window == root) && !ev->same_screen)
 		issel = False;
-		drawall();
-	}
 }
 
 static void
@@ -329,7 +326,8 @@
 		}
 		if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
 			updatetitle(c);
-			drawclient(c);
+			if(c == sel)
+				drawstatus();
 		}
 	}
 }
--- a/view.c	Sun Jan 14 22:37:34 2007 +0100
+++ b/view.c	Mon Jan 15 12:04:25 2007 +0100
@@ -200,7 +200,6 @@
 			XLowerWindow(dpy, c->win);
 		}
 	}
-	drawall();
 	XSync(dpy, False);
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }