Xinqi Bao's Git
projects
/
dwm.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
0e5c819
)
made stdin reader more robust
author
Anselm R. Garbe <
[email protected]
>
Fri, 14 Jul 2006 10:08:32 +0000
(12:08 +0200)
committer
Anselm R. Garbe <
[email protected]
>
Fri, 14 Jul 2006 10:08:32 +0000
(12:08 +0200)
client.c
diff
|
blob
|
history
main.c
diff
|
blob
|
history
diff --git
a/client.c
b/client.c
index
e0ab719
..
3aae7e0
100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-404,8
+404,6
@@
manage(Window w, XWindowAttributes *wa)
c->next = *l; /* *l == nil */
*l = c;
c->next = *l; /* *l == nil */
*l = c;
- XMapRaised(dpy, c->win);
- XMapRaised(dpy, c->title);
XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
@@
-418,10
+416,17
@@
manage(Window w, XWindowAttributes *wa)
|| ((c->maxw == c->minw) && (c->maxh == c->minh));
arrange(NULL);
|| ((c->maxw == c->minw) && (c->maxh == c->minh));
arrange(NULL);
- if(c->tags[tsel])
+ /* mapping the window now prevents flicker */
+ if(c->tags[tsel]) {
+ XMapRaised(dpy, c->win);
+ XMapRaised(dpy, c->title);
focus(c);
focus(c);
- else
+ }
+ else {
ban_client(c);
ban_client(c);
+ XMapRaised(dpy, c->win);
+ XMapRaised(dpy, c->title);
+ }
}
void
}
void
diff --git
a/main.c
b/main.c
index
bfc63b1
..
0e851b3
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-264,6
+264,10
@@
main(int argc, char *argv[])
XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin);
XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin);
+ dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
+ dc.gc = XCreateGC(dpy, root, 0, 0);
+ draw_bar();
+
issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
@@
-272,15
+276,12
@@
main(int argc, char *argv[])
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
- dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
- dc.gc = XCreateGC(dpy, root, 0, 0);
-
strcpy(stext, "dwm-"VERSION);
scan_wins();
strcpy(stext, "dwm-"VERSION);
scan_wins();
- draw_bar();
/* main event loop, reads status text from stdin as well */
while(running) {
/* main event loop, reads status text from stdin as well */
while(running) {
+Mainloop:
FD_ZERO(&rd);
FD_SET(0, &rd);
FD_SET(ConnectionNumber(dpy), &rd);
FD_ZERO(&rd);
FD_SET(0, &rd);
FD_SET(ConnectionNumber(dpy), &rd);
@@
-298,8
+299,15
@@
main(int argc, char *argv[])
}
if(FD_ISSET(0, &rd)) {
i = n = 0;
}
if(FD_ISSET(0, &rd)) {
i = n = 0;
- while((i = getchar()) != '\n' && n < sizeof(stext) - 1)
+ for(;;) {
+ if((i = getchar()) == EOF) {
+ stext[0] = 0;
+ goto Mainloop;
+ }
+ if(i == '\n' || n >= sizeof(stext) - 1)
+ break;
stext[n++] = i;
stext[n++] = i;
+ }
stext[n] = 0;
draw_bar();
}
stext[n] = 0;
draw_bar();
}