summaryrefslogtreecommitdiffhomepage
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/dwm.c b/dwm.c
index 2bd28e6..5d53587 100644
--- a/dwm.c
+++ b/dwm.c
@@ -2744,27 +2744,23 @@ quit(const Arg *arg)
#if COOL_AUTOSTART_PATCH
size_t i;
#endif // COOL_AUTOSTART_PATCH
+ #if RESTARTSIG_PATCH
+ restart = arg->i;
+ #endif // RESTARTSIG_PATCH
#if ONLYQUITONEMPTY_PATCH
- unsigned int n;
- Window *junk = malloc(1);
+ Monitor *m;
+ Client *c;
+ unsigned int n = 0;
- XQueryTree(dpy, root, junk, junk, &junk, &n);
+ for (m = mons; m; m = m->next)
+ for (c = m->clients; c; c = c->next, n++);
- if (n <= quit_empty_window_count)
- {
- #if RESTARTSIG_PATCH
- restart = arg->i;
- #endif // RESTARTSIG_PATCH
+ if (restart || n <= quit_empty_window_count)
running = 0;
- }
else
- printf("[dwm] not exiting (n=%d)\n", n);
+ fprintf(stderr, "[dwm] not exiting (n=%d)\n", n);
- free(junk);
#else // !ONLYQUITONEMPTY_PATCH
- #if RESTARTSIG_PATCH
- restart = arg->i;
- #endif // RESTARTSIG_PATCH
running = 0;
#endif // ONLYQUITONEMPTY_PATCH