comparison main.c @ 275:425cd4490c1e

some other small fixes
author Anselm R.Garbe <arg@10ksloc.org>
date Mon, 14 Aug 2006 15:11:02 +0200
parents 97e8cb712fd9
children c1187ddcd7f7
comparison
equal deleted inserted replaced
274:97e8cb712fd9 275:425cd4490c1e
194 if(otherwm) 194 if(otherwm)
195 eprint("dwm: another window manager is already running\n"); 195 eprint("dwm: another window manager is already running\n");
196 196
197 XSetErrorHandler(NULL); 197 XSetErrorHandler(NULL);
198 xerrorxlib = XSetErrorHandler(xerror); 198 xerrorxlib = XSetErrorHandler(xerror);
199 XSync(dpy, False);
199 200
200 /* init atoms */ 201 /* init atoms */
201 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 202 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
202 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 203 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
203 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 204 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
267 if(i == -1 && errno == EINTR) 268 if(i == -1 && errno == EINTR)
268 continue; 269 continue;
269 if(i < 0) 270 if(i < 0)
270 eprint("select failed\n"); 271 eprint("select failed\n");
271 else if(i > 0) { 272 else if(i > 0) {
272 if(FD_ISSET(xfd, &rd)) {
273 while(XPending(dpy)) {
274 XNextEvent(dpy, &ev);
275 if(handler[ev.type])
276 (handler[ev.type])(&ev); /* call handler */
277 }
278 }
279 if(readin && FD_ISSET(STDIN_FILENO, &rd)) { 273 if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
280 readin = NULL != fgets(stext, sizeof(stext), stdin); 274 readin = NULL != fgets(stext, sizeof(stext), stdin);
281 if(readin) 275 if(readin)
282 stext[strlen(stext) - 1] = 0; 276 stext[strlen(stext) - 1] = 0;
283 else 277 else
284 strcpy(stext, "broken pipe"); 278 strcpy(stext, "broken pipe");
285 drawstatus(); 279 drawstatus();
286 } 280 }
281 if(FD_ISSET(xfd, &rd)) {
282 while(XPending(dpy)) {
283 XNextEvent(dpy, &ev);
284 if(handler[ev.type])
285 (handler[ev.type])(&ev); /* call handler */
286 }
287 }
287 } 288 }
288 } 289 }
289
290 cleanup(); 290 cleanup();
291 XCloseDisplay(dpy); 291 XCloseDisplay(dpy);
292 292
293 return 0; 293 return 0;
294 } 294 }