summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-15 12:04:25 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-15 12:04:25 +0100
commitf8181f64e2ba4fca4e85036c48cf90a2151794fc (patch)
tree7d82e76b3214ca5e09a25ce8e68f1fbf1491c138
parentimplemented new color scheme accordingly to Sanders proposal (diff)
downloaddwm-f8181f64e2ba4fca4e85036c48cf90a2151794fc.tar.gz
dwm-f8181f64e2ba4fca4e85036c48cf90a2151794fc.zip
removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles)
-rw-r--r--client.c5
-rw-r--r--draw.c20
-rw-r--r--dwm.h2
-rw-r--r--event.c8
-rw-r--r--view.c1
5 files changed, 6 insertions, 30 deletions
diff --git a/client.c b/client.c
index af13797..b122427 100644
--- a/client.c
+++ b/client.c
@@ -90,7 +90,7 @@ focus(Client *c) {
90 sel = c; 90 sel = c;
91 if(old) { 91 if(old) {
92 grabbuttons(old, False); 92 grabbuttons(old, False);
93 drawclient(old); 93 XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
94 } 94 }
95 } 95 }
96 if(c) { 96 if(c) {
@@ -98,11 +98,12 @@ focus(Client *c) {
98 c->snext = stack; 98 c->snext = stack;
99 stack = c; 99 stack = c;
100 grabbuttons(c, True); 100 grabbuttons(c, True);
101 drawclient(c); 101 XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
102 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 102 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
103 } 103 }
104 else 104 else
105 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 105 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
106 drawstatus();
106} 107}
107 108
108Client * 109Client *
diff --git a/draw.c b/draw.c
index 19604f3..fe2951c 100644
--- a/draw.c
+++ b/draw.c
@@ -98,15 +98,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool filledsquare, Bool e
98/* extern */ 98/* extern */
99 99
100void 100void
101drawall(void) {
102 Client *c;
103
104 for(c = clients; c; c = getnext(c->next))
105 drawclient(c);
106 drawstatus();
107}
108
109void
110drawstatus(void) { 101drawstatus(void) {
111 int i, x; 102 int i, x;
112 103
@@ -137,17 +128,6 @@ drawstatus(void) {
137 XSync(dpy, False); 128 XSync(dpy, False);
138} 129}
139 130
140void
141drawclient(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 XSync(dpy, False);
149}
150
151unsigned long 131unsigned long
152getcolor(const char *colstr) { 132getcolor(const char *colstr) {
153 Colormap cmap = DefaultColormap(dpy, screen); 133 Colormap cmap = DefaultColormap(dpy, screen);
diff --git a/dwm.h b/dwm.h
index 3789373..03f8c1f 100644
--- a/dwm.h
+++ b/dwm.h
@@ -117,9 +117,7 @@ extern void updatetitle(Client *c); /* update the name of c */
117extern void unmanage(Client *c); /* destroy c */ 117extern void unmanage(Client *c); /* destroy c */
118 118
119/* draw.c */ 119/* draw.c */
120extern void drawall(void); /* draw all visible client titles and the bar */
121extern void drawstatus(void); /* draw the bar */ 120extern void drawstatus(void); /* draw the bar */
122extern void drawclient(Client *c); /* draw title and set border of c */
123extern unsigned long getcolor(const char *colstr); /* return color of colstr */ 121extern unsigned long getcolor(const char *colstr); /* return color of colstr */
124extern void setfont(const char *fontstr); /* set the font for DC */ 122extern void setfont(const char *fontstr); /* set the font for DC */
125extern unsigned int textw(const char *text); /* return the width of text in px*/ 123extern unsigned int textw(const char *text); /* return the width of text in px*/
diff --git a/event.c b/event.c
index a9d2fbb..a809511 100644
--- a/event.c
+++ b/event.c
@@ -235,7 +235,6 @@ enternotify(XEvent *e) {
235 else if(ev->window == root) { 235 else if(ev->window == root) {
236 issel = True; 236 issel = True;
237 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 237 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
238 drawall();
239 } 238 }
240} 239}
241 240
@@ -272,10 +271,8 @@ static void
272leavenotify(XEvent *e) { 271leavenotify(XEvent *e) {
273 XCrossingEvent *ev = &e->xcrossing; 272 XCrossingEvent *ev = &e->xcrossing;
274 273
275 if((ev->window == root) && !ev->same_screen) { 274 if((ev->window == root) && !ev->same_screen)
276 issel = False; 275 issel = False;
277 drawall();
278 }
279} 276}
280 277
281static void 278static void
@@ -329,7 +326,8 @@ propertynotify(XEvent *e) {
329 } 326 }
330 if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { 327 if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
331 updatetitle(c); 328 updatetitle(c);
332 drawclient(c); 329 if(c == sel)
330 drawstatus();
333 } 331 }
334 } 332 }
335} 333}
diff --git a/view.c b/view.c
index 935525f..bc1f4e2 100644
--- a/view.c
+++ b/view.c
@@ -200,7 +200,6 @@ restack(void) {
200 XLowerWindow(dpy, c->win); 200 XLowerWindow(dpy, c->win);
201 } 201 }
202 } 202 }
203 drawall();
204 XSync(dpy, False); 203 XSync(dpy, False);
205 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 204 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
206} 205}