removed a bottleneck
This commit is contained in:
parent
a1d0f81966
commit
6475be926b
14
main.c
14
main.c
|
@ -283,7 +283,7 @@ main(int argc, char *argv[])
|
||||||
Mainloop:
|
Mainloop:
|
||||||
while(running) {
|
while(running) {
|
||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
FD_SET(0, &rd);
|
FD_SET(STDIN_FILENO, &rd);
|
||||||
FD_SET(ConnectionNumber(dpy), &rd);
|
FD_SET(ConnectionNumber(dpy), &rd);
|
||||||
|
|
||||||
i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
|
i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
|
||||||
|
@ -292,12 +292,14 @@ Mainloop:
|
||||||
if(i < 0)
|
if(i < 0)
|
||||||
error("select failed\n");
|
error("select failed\n");
|
||||||
else if(i > 0) {
|
else if(i > 0) {
|
||||||
if(FD_ISSET(ConnectionNumber(dpy), &rd) && XPending(dpy) > 0) {
|
if(FD_ISSET(ConnectionNumber(dpy), &rd)) {
|
||||||
XNextEvent(dpy, &ev);
|
while(XPending(dpy)) {
|
||||||
if(handler[ev.type])
|
XNextEvent(dpy, &ev);
|
||||||
(handler[ev.type])(&ev); /* call handler */
|
if(handler[ev.type])
|
||||||
|
(handler[ev.type])(&ev); /* call handler */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(FD_ISSET(0, &rd)) {
|
if(FD_ISSET(STDIN_FILENO, &rd)) {
|
||||||
i = n = 0;
|
i = n = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if((i = getchar()) == EOF) {
|
if((i = getchar()) == EOF) {
|
||||||
|
|
Loading…
Reference in a new issue