Mercurial > dwm-meillo
comparison main.c @ 164:21071ae1fe68
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
author | arg@10ksloc.org |
---|---|
date | Wed, 02 Aug 2006 16:32:05 +0200 |
parents | a6a31e485fbd |
children | e848966a1ac6 |
comparison
equal
deleted
inserted
replaced
163:e2e1de08341d | 164:21071ae1fe68 |
---|---|
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
3 * See LICENSE file for license details. | 3 * See LICENSE file for license details. |
4 */ | 4 */ |
5 | 5 |
6 #include "dwm.h" | 6 #include "dwm.h" |
7 | |
8 #include <errno.h> | 7 #include <errno.h> |
9 #include <stdio.h> | 8 #include <stdio.h> |
10 #include <stdlib.h> | 9 #include <stdlib.h> |
11 #include <string.h> | 10 #include <string.h> |
12 #include <unistd.h> | 11 #include <unistd.h> |
13 #include <sys/select.h> | 12 #include <sys/select.h> |
14 #include <X11/cursorfont.h> | 13 #include <X11/cursorfont.h> |
15 #include <X11/Xatom.h> | 14 #include <X11/Xatom.h> |
16 #include <X11/Xproto.h> | 15 #include <X11/Xproto.h> |
17 | |
18 | 16 |
19 /* static */ | 17 /* static */ |
20 | 18 |
21 static int (*xerrorxlib)(Display *, XErrorEvent *); | 19 static int (*xerrorxlib)(Display *, XErrorEvent *); |
22 static Bool otherwm; | 20 static Bool otherwm; |
163 main(int argc, char *argv[]) | 161 main(int argc, char *argv[]) |
164 { | 162 { |
165 int i; | 163 int i; |
166 unsigned int mask; | 164 unsigned int mask; |
167 fd_set rd; | 165 fd_set rd; |
166 Bool readin = True; | |
168 Window w; | 167 Window w; |
169 XEvent ev; | 168 XEvent ev; |
170 XSetWindowAttributes wa; | 169 XSetWindowAttributes wa; |
171 | 170 |
172 if(argc == 2 && !strncmp("-v", argv[1], 3)) { | 171 if(argc == 2 && !strncmp("-v", argv[1], 3)) { |
249 scan(); | 248 scan(); |
250 | 249 |
251 /* main event loop, reads status text from stdin as well */ | 250 /* main event loop, reads status text from stdin as well */ |
252 while(running) { | 251 while(running) { |
253 FD_ZERO(&rd); | 252 FD_ZERO(&rd); |
254 FD_SET(STDIN_FILENO, &rd); | 253 if(readin) |
254 FD_SET(STDIN_FILENO, &rd); | |
255 FD_SET(ConnectionNumber(dpy), &rd); | 255 FD_SET(ConnectionNumber(dpy), &rd); |
256 | 256 |
257 i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); | 257 i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); |
258 if(i == -1 && errno == EINTR) | 258 if(i == -1 && errno == EINTR) |
259 continue; | 259 continue; |
265 XNextEvent(dpy, &ev); | 265 XNextEvent(dpy, &ev); |
266 if(handler[ev.type]) | 266 if(handler[ev.type]) |
267 (handler[ev.type])(&ev); /* call handler */ | 267 (handler[ev.type])(&ev); /* call handler */ |
268 } | 268 } |
269 } | 269 } |
270 if(FD_ISSET(STDIN_FILENO, &rd)) { | 270 if(readin && FD_ISSET(STDIN_FILENO, &rd)) { |
271 if(!fgets(stext, sizeof(stext), stdin)) | 271 readin = NULL != fgets(stext, sizeof(stext), stdin); |
272 break; | 272 if(readin) |
273 stext[strlen(stext) - 1] = 0; | |
273 else | 274 else |
274 stext[strlen(stext) - 1] = 0; | 275 strcpy(stext, "broken pipe"); |
275 drawstatus(); | 276 drawstatus(); |
276 } | 277 } |
277 } | 278 } |
278 } | 279 } |
279 | 280 |