]> git.lizzy.rs Git - bspwm.git/blobdiff - bspwm.c
More informative output for 'list*' messages
[bspwm.git] / bspwm.c
diff --git a/bspwm.c b/bspwm.c
index 87155d3e6c3f6e0f0bd7b9e240f02022c61b8242..377052efe51c1f2ed7ac640e262d0f8fbc724d02 100644 (file)
--- a/bspwm.c
+++ b/bspwm.c
@@ -30,6 +30,15 @@ void quit(void)
     running = false;
 }
 
+void cleanup(void)
+{
+    while (mon_head != NULL)
+        remove_monitor(mon_head);
+    while (rule_head != NULL)
+        remove_rule(rule_head);
+    free(frozen_pointer);
+}
+
 void register_events(void)
 {
     uint32_t values[] = {ROOT_EVENT_MASK};
@@ -97,7 +106,7 @@ void setup(void)
 
     xcb_ewmh_set_supported(ewmh, default_screen, LENGTH(net_atoms), net_atoms);
 
-    monitor_uid = desktop_uid = client_uid = 0;
+    monitor_uid = desktop_uid = client_uid = rule_uid = 0;
     mon = last_mon = mon_head = mon_tail = NULL;
 
     bool xinerama_is_active = false;
@@ -133,10 +142,13 @@ void setup(void)
     ewmh_update_number_of_desktops();
     ewmh_update_desktop_names();
     ewmh_update_current_desktop();
-    rule_head = make_rule();
+    rule_head = rule_tail = NULL;
     frozen_pointer = make_pointer_state();
     get_pointer_position(&pointer_position);
+    last_entered = XCB_NONE;
     split_mode = MODE_AUTOMATIC;
+    visible = true;
+    exit_status = 0;
 }
 
 int main(int argc, char *argv[])
@@ -241,6 +253,7 @@ int main(int argc, char *argv[])
         }
     }
 
+    cleanup();
     close(sock_fd);
     if (status_fifo != NULL)
         fclose(status_fifo);
@@ -248,5 +261,5 @@ int main(int argc, char *argv[])
     free(ewmh);
     xcb_flush(dpy);
     xcb_disconnect(dpy);
-    return 0;
+    return exit_status;
 }