]> git.sur5r.net Git - i3/i3/blobdiff - src/ipc.c
Replace the discrete 'split' Con property with a simple function.
[i3/i3] / src / ipc.c
index 77b8dbb391101eb50c32a80e8b69d669f7aff7a7..5232acf2779cdb8a406f9a6a42ca8577433fb3d3 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -1,3 +1,5 @@
+#undef I3__FILE__
+#define I3__FILE__ "ipc.c"
 /*
  * vim:ts=4:sw=4:expandtab
  *
@@ -50,7 +52,7 @@ static bool mkdirp(const char *path) {
         ELOG("mkdir(%s) failed: %s\n", path, strerror(errno));
         return false;
     }
-    char *copy = strdup(path);
+    char *copy = sstrdup(path);
     /* strip trailing slashes, if any */
     while (copy[strlen(copy)-1] == '/')
         copy[strlen(copy)-1] = '\0';
@@ -163,7 +165,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
 
     /* provided for backwards compatibility only. */
     ystr("orientation");
-    if (!con->split)
+    if (!con_is_split(con))
         ystr("none");
     else {
         if (con_orientation(con) == HORIZ)
@@ -200,9 +202,6 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
     ystr("focused");
     y(bool, (con == focused));
 
-    ystr("split");
-    y(bool, con->split);
-
     ystr("layout");
     switch (con->layout) {
         case L_DEFAULT:
@@ -229,6 +228,23 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
             break;
     }
 
+    ystr("workspace_layout");
+    switch (con->workspace_layout) {
+        case L_DEFAULT:
+            ystr("default");
+            break;
+        case L_STACKED:
+            ystr("stacked");
+            break;
+        case L_TABBED:
+            ystr("tabbed");
+            break;
+        default:
+            DLOG("About to dump workspace_layout=%d (none of default/stacked/tabbed), this is a bug.\n", con->workspace_layout);
+            assert(false);
+            break;
+    }
+
     ystr("last_split_layout");
     switch (con->layout) {
         case L_SPLITV:
@@ -247,18 +263,21 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
         case BS_NONE:
             ystr("none");
             break;
-        case BS_1PIXEL:
-            ystr("1pixel");
+        case BS_PIXEL:
+            ystr("pixel");
             break;
     }
 
+    ystr("current_border_width");
+    y(integer, con->current_border_width);
+
     dump_rect(gen, "rect", con->rect);
     dump_rect(gen, "window_rect", con->window_rect);
     dump_rect(gen, "geometry", con->geometry);
 
     ystr("name");
-    if (con->window && con->window->name_json)
-        ystr(con->window->name_json);
+    if (con->window && con->window->name)
+        ystr(i3string_as_utf8(con->window->name));
     else
         ystr(con->name);
 
@@ -386,7 +405,7 @@ IPC_HANDLER(get_workspaces) {
 
     Con *output;
     TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
-        if (output->name[0] == '_' && output->name[1] == '_')
+        if (con_is_internal(output))
             continue;
         Con *ws;
         TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
@@ -758,7 +777,7 @@ static int add_subscription(void *extra, const unsigned char *s,
 #endif
     ipc_client *client = extra;
 
-    DLOG("should add subscription to extra %p, sub %.*s\n", client, len, s);
+    DLOG("should add subscription to extra %p, sub %.*s\n", client, (int)len, s);
     int event = client->num_events;
 
     client->num_events++;