removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles)

This commit is contained in:
Anselm R. Garbe 2007-01-15 12:04:25 +01:00
parent 0045ad87df
commit f8181f64e2
5 changed files with 6 additions and 30 deletions

View File

@ -90,7 +90,7 @@ focus(Client *c) {
sel = c; sel = c;
if(old) { if(old) {
grabbuttons(old, False); grabbuttons(old, False);
drawclient(old); XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
} }
} }
if(c) { if(c) {
@ -98,11 +98,12 @@ focus(Client *c) {
c->snext = stack; c->snext = stack;
stack = c; stack = c;
grabbuttons(c, True); grabbuttons(c, True);
drawclient(c); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
} }
else else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
drawstatus();
} }
Client * Client *

20
draw.c
View File

@ -97,15 +97,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool filledsquare, Bool e
/* extern */ /* extern */
void
drawall(void) {
Client *c;
for(c = clients; c; c = getnext(c->next))
drawclient(c);
drawstatus();
}
void void
drawstatus(void) { drawstatus(void) {
int i, x; int i, x;
@ -137,17 +128,6 @@ drawstatus(void) {
XSync(dpy, False); 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 unsigned long
getcolor(const char *colstr) { getcolor(const char *colstr) {
Colormap cmap = DefaultColormap(dpy, screen); Colormap cmap = DefaultColormap(dpy, screen);

2
dwm.h
View File

@ -117,9 +117,7 @@ extern void updatetitle(Client *c); /* update the name of c */
extern void unmanage(Client *c); /* destroy c */ extern void unmanage(Client *c); /* destroy c */
/* draw.c */ /* draw.c */
extern void drawall(void); /* draw all visible client titles and the bar */
extern void drawstatus(void); /* draw 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 unsigned long getcolor(const char *colstr); /* return color of colstr */
extern void setfont(const char *fontstr); /* set the font for DC */ 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*/ extern unsigned int textw(const char *text); /* return the width of text in px*/

View File

@ -235,7 +235,6 @@ enternotify(XEvent *e) {
else if(ev->window == root) { else if(ev->window == root) {
issel = True; issel = True;
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
drawall();
} }
} }
@ -272,10 +271,8 @@ static void
leavenotify(XEvent *e) { leavenotify(XEvent *e) {
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
if((ev->window == root) && !ev->same_screen) { if((ev->window == root) && !ev->same_screen)
issel = False; issel = False;
drawall();
}
} }
static void static void
@ -329,7 +326,8 @@ propertynotify(XEvent *e) {
} }
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c); updatetitle(c);
drawclient(c); if(c == sel)
drawstatus();
} }
} }
} }

1
view.c
View File

@ -200,7 +200,6 @@ restack(void) {
XLowerWindow(dpy, c->win); XLowerWindow(dpy, c->win);
} }
} }
drawall();
XSync(dpy, False); XSync(dpy, False);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
} }