]> git.sur5r.net Git - i3/i3/blobdiff - src/tree.c
fix warnings: unsigned check for >= 0 is always true
[i3/i3] / src / tree.c
index 4df9f5938e48b8b1af04c0c285a8c1ed50651cd8..48ab163da596c94b1811c6082e61adb6b5bbda37 100644 (file)
@@ -84,7 +84,7 @@ bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry) {
     };
     focused = croot;
 
-    tree_append_json(globbed);
+    tree_append_json(globbed, NULL);
 
     printf("appended tree, using new root\n");
     croot = TAILQ_FIRST(&(croot->nodes_head));
@@ -229,11 +229,6 @@ bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool
         return false;
     }
 
-    if (workspace_is_visible(con)) {
-        DLOG("A visible workspace cannot be killed.\n");
-        return false;
-    }
-
     if (con->window != NULL) {
         if (kill_window != DONT_KILL_WINDOW) {
             x_window_kill(con->window->id, kill_window);
@@ -369,6 +364,19 @@ void tree_close_con(kill_window_t kill_window) {
     assert(focused->type != CT_OUTPUT);
     assert(focused->type != CT_ROOT);
 
+    if (focused->type == CT_WORKSPACE) {
+        DLOG("Workspaces cannot be close, closing all children instead\n");
+        Con *child, *nextchild;
+        for (child = TAILQ_FIRST(&(focused->focus_head)); child; ) {
+            nextchild = TAILQ_NEXT(child, focused);
+            DLOG("killing child=%p\n", child);
+            tree_close(child, kill_window, false, false);
+            child = nextchild;
+        }
+
+        return;
+    }
+
     /* Kill con */
     tree_close(focused, kill_window, false, false);
 }
@@ -379,7 +387,7 @@ void tree_close_con(kill_window_t kill_window) {
  *
  */
 void tree_split(Con *con, orientation_t orientation) {
-    if (con->type == CT_FLOATING_CON) {
+    if (con_is_floating(con)) {
         DLOG("Floating containers can't be split.\n");
         return;
     }