diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 18:15:11 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 18:15:11 +0200 |
| commit | 586f66331d1105be03c42e6faeae1672b974a98a (patch) | |
| tree | b5a4f654969baf431ac0f10dad2354d70e7efc2b /wm.c | |
| parent | added protocol killing stuff (diff) | |
| download | dwm-586f66331d1105be03c42e6faeae1672b974a98a.tar.gz dwm-586f66331d1105be03c42e6faeae1672b974a98a.zip | |
added bar event timer
Diffstat (limited to '')
| -rw-r--r-- | wm.c | 33 |
1 files changed, 25 insertions, 8 deletions
| @@ -3,10 +3,15 @@ | |||
| 3 | * See LICENSE file for license details. | 3 | * See LICENSE file for license details. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include <errno.h> | ||
| 7 | |||
| 6 | #include <stdarg.h> | 8 | #include <stdarg.h> |
| 7 | #include <stdio.h> | 9 | #include <stdio.h> |
| 8 | #include <stdlib.h> | 10 | #include <stdlib.h> |
| 9 | 11 | ||
| 12 | #include <sys/types.h> | ||
| 13 | #include <sys/time.h> | ||
| 14 | |||
| 10 | #include <X11/cursorfont.h> | 15 | #include <X11/cursorfont.h> |
| 11 | #include <X11/Xatom.h> | 16 | #include <X11/Xatom.h> |
| 12 | #include <X11/Xproto.h> | 17 | #include <X11/Xproto.h> |
| @@ -160,12 +165,9 @@ startup_error_handler(Display *dpy, XErrorEvent *error) | |||
| 160 | static void | 165 | static void |
| 161 | cleanup() | 166 | cleanup() |
| 162 | { | 167 | { |
| 163 | /* | 168 | while(clients) |
| 164 | Client *c; | 169 | unmanage(clients); |
| 165 | for(c=client; c; c=c->next) | ||
| 166 | reparent_client(c, root, c->sel->rect.x, c->sel->rect.y); | ||
| 167 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); | 170 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
| 168 | */ | ||
| 169 | } | 171 | } |
| 170 | 172 | ||
| 171 | int | 173 | int |
| @@ -176,6 +178,11 @@ main(int argc, char *argv[]) | |||
| 176 | unsigned int mask; | 178 | unsigned int mask; |
| 177 | Window w; | 179 | Window w; |
| 178 | XEvent ev; | 180 | XEvent ev; |
| 181 | fd_set fds; | ||
| 182 | struct timeval t, timeout = { | ||
| 183 | .tv_usec = 0, | ||
| 184 | .tv_sec = STATUSDELAY, | ||
| 185 | }; | ||
| 179 | 186 | ||
| 180 | /* command line args */ | 187 | /* command line args */ |
| 181 | for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { | 188 | for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { |
| @@ -264,9 +271,19 @@ main(int argc, char *argv[]) | |||
| 264 | scan_wins(); | 271 | scan_wins(); |
| 265 | 272 | ||
| 266 | while(running) { | 273 | while(running) { |
| 267 | XNextEvent(dpy, &ev); | 274 | if(XPending(dpy) > 0) { |
| 268 | if(handler[ev.type]) | 275 | XNextEvent(dpy, &ev); |
| 269 | (handler[ev.type]) (&ev); /* call handler */ | 276 | if(handler[ev.type]) |
| 277 | (handler[ev.type]) (&ev); /* call handler */ | ||
| 278 | continue; | ||
| 279 | } | ||
| 280 | FD_ZERO(&fds); | ||
| 281 | FD_SET(ConnectionNumber(dpy), &fds); | ||
| 282 | t = timeout; | ||
| 283 | if(select(ConnectionNumber(dpy) + 1, &fds, NULL, NULL, &t) > 0) | ||
| 284 | continue; | ||
| 285 | else if(errno != EINTR) | ||
| 286 | draw_bar(); | ||
| 270 | } | 287 | } |
| 271 | 288 | ||
| 272 | cleanup(); | 289 | cleanup(); |
