dwm-meillo
diff main.c @ 265:573b1c4a71a4
reducing ConnectionNumber calls to a bare minimum
author | Anselm R.Garbe <arg@10ksloc.org> |
---|---|
date | Mon, 14 Aug 2006 07:23:46 +0200 |
parents | d659a2dce2b5 |
children | e8aa8f6e3481 |
line diff
1.1 --- a/main.c Sun Aug 13 18:04:42 2006 +0200 1.2 +++ b/main.c Mon Aug 14 07:23:46 2006 +0200 1.3 @@ -162,7 +162,7 @@ 1.4 int 1.5 main(int argc, char *argv[]) 1.6 { 1.7 - int i; 1.8 + int i, xfd; 1.9 unsigned int mask; 1.10 fd_set rd; 1.11 Bool readin = True; 1.12 @@ -181,6 +181,7 @@ 1.13 if(!dpy) 1.14 eprint("dwm: cannot open display\n"); 1.15 1.16 + xfd = ConnectionNumber(dpy); 1.17 screen = DefaultScreen(dpy); 1.18 root = RootWindow(dpy, screen); 1.19 1.20 @@ -260,15 +261,15 @@ 1.21 FD_ZERO(&rd); 1.22 if(readin) 1.23 FD_SET(STDIN_FILENO, &rd); 1.24 - FD_SET(ConnectionNumber(dpy), &rd); 1.25 + FD_SET(xfd, &rd); 1.26 1.27 - i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); 1.28 + i = select(xfd + 1, &rd, 0, 0, 0); 1.29 if(i == -1 && errno == EINTR) 1.30 continue; 1.31 if(i < 0) 1.32 eprint("select failed\n"); 1.33 else if(i > 0) { 1.34 - if(FD_ISSET(ConnectionNumber(dpy), &rd)) { 1.35 + if(FD_ISSET(xfd, &rd)) { 1.36 while(XPending(dpy)) { 1.37 XNextEvent(dpy, &ev); 1.38 if(handler[ev.type])