about summary refs log tree commit diff stats
path: root/main.c
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
committerarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
commit95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6 (patch)
tree98283068f4576b8b2e825dd5eff0eb6e94ddbdc0 /main.c
parenta55f0e12fe5c1205f4d3e40c164fd087224fad7a (diff)
downloaddwm-95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6.tar.gz
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/main.c b/main.c
index 86d72fa..33a2a9a 100644
--- a/main.c
+++ b/main.c
@@ -4,7 +4,6 @@
  */
 
 #include "dwm.h"
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -15,7 +14,6 @@
 #include <X11/Xatom.h>
 #include <X11/Xproto.h>
 
-
 /* static */
 
 static int (*xerrorxlib)(Display *, XErrorEvent *);
@@ -165,6 +163,7 @@ main(int argc, char *argv[])
 	int i;
 	unsigned int mask;
 	fd_set rd;
+	Bool readin = True;
 	Window w;
 	XEvent ev;
 	XSetWindowAttributes wa;
@@ -251,7 +250,8 @@ main(int argc, char *argv[])
 	/* main event loop, reads status text from stdin as well */
 	while(running) {
 		FD_ZERO(&rd);
-		FD_SET(STDIN_FILENO, &rd);
+		if(readin)
+			FD_SET(STDIN_FILENO, &rd);
 		FD_SET(ConnectionNumber(dpy), &rd);
 
 		i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
@@ -267,11 +267,12 @@ main(int argc, char *argv[])
 						(handler[ev.type])(&ev); /* call handler */
 				}
 			}
-			if(FD_ISSET(STDIN_FILENO, &rd)) {
-				if(!fgets(stext, sizeof(stext), stdin))
-					break;
-				else 
+			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
+				readin = NULL != fgets(stext, sizeof(stext), stdin);
+				if(readin)
 					stext[strlen(stext) - 1] = 0;
+				else 
+					strcpy(stext, "broken pipe");
 				drawstatus();
 			}
 		}