]> git.sur5r.net Git - i3/i3/commitdiff
don’t set names corresponding to debug colors, remove “sleep 1”.
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 15 Jul 2014 08:35:52 +0000 (10:35 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 15 Jul 2014 08:36:31 +0000 (10:36 +0200)
The names were (mostly) internal to i3 anyway.

Hopefully this doesn’t break anything, but I really think this old
behavior needs to go now :).

src/con.c
src/ipc.c
src/load_layout.c
src/restore_layout.c
testcases/t/122-split.t

index 78fe5fef55268494957e529e23a54a284440cddf..282c389f694c78e1a735fa193e2bcb9172ecca37 100644 (file)
--- a/src/con.c
+++ b/src/con.c
  */
 #include "all.h"
 
-char *colors[] = {
-    "#ff0000",
-    "#00FF00",
-    "#0000FF",
-    "#ff00ff",
-    "#00ffff",
-    "#ffff00",
-    "#aa0000",
-    "#00aa00",
-    "#0000aa",
-    "#aa00aa"};
-
 static void con_on_remove_child(Con *con);
 
 /*
@@ -59,16 +47,7 @@ Con *con_new_skeleton(Con *parent, i3Window *window) {
         new->depth = window->depth;
     else
         new->depth = XCB_COPY_FROM_PARENT;
-    static int cnt = 0;
-    DLOG("opening window %d\n", cnt);
-
-    /* TODO: remove window coloring after test-phase */
-    DLOG("color %s\n", colors[cnt]);
-    new->name = strdup(colors[cnt]);
-    //uint32_t cp = get_colorpixel(colors[cnt]);
-    cnt++;
-    if ((cnt % (sizeof(colors) / sizeof(char *))) == 0)
-        cnt = 0;
+    DLOG("opening window\n");
 
     TAILQ_INIT(&(new->floating_head));
     TAILQ_INIT(&(new->nodes_head));
index d6bb34a4b5997651003c7c295b475f0a9f15eca1..59f0938dfb3d7aac4665be84e736af4003272562 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -299,8 +299,10 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
     ystr("name");
     if (con->window && con->window->name)
         ystr(i3string_as_utf8(con->window->name));
-    else
+    else if (con->name != NULL)
         ystr(con->name);
+    else
+        y(null);
 
     if (con->type == CT_WORKSPACE) {
         ystr("num");
index ee50660baa809303cb4bbe8ca7a993a18ac7eecf..5fe7c84c60358c20cfb7afc00e2f624543e16474 100644 (file)
@@ -98,26 +98,21 @@ static int json_end_map(void *ctx) {
              * workspace called “1”. */
             Con *output;
             Con *workspace = NULL;
-            TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
-                GREP_FIRST(workspace, output_get_content(output), !strcasecmp(child->name, json_node->name));
+            TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
+            GREP_FIRST(workspace, output_get_content(output), !strcasecmp(child->name, json_node->name));
             char *base = sstrdup(json_node->name);
             int cnt = 1;
             while (workspace != NULL) {
                 FREE(json_node->name);
                 asprintf(&(json_node->name), "%s_%d", base, cnt++);
                 workspace = NULL;
-                TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
-                    GREP_FIRST(workspace, output_get_content(output), !strcasecmp(child->name, json_node->name));
+                TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
+                GREP_FIRST(workspace, output_get_content(output), !strcasecmp(child->name, json_node->name));
             }
             free(base);
 
             /* Set num accordingly so that i3bar will properly sort it. */
             json_node->num = ws_name_to_number(json_node->name);
-        } else {
-            // TODO: remove this in the “next” branch.
-            if (json_node->name == NULL || strcmp(json_node->name, "") == 0) {
-                json_node->name = sstrdup("#ff0000");
-            }
         }
 
         LOG("attaching\n");
index d6d7927d27f821c3c69387bdcb8735ff913a5617..3a657c90bf4123de34315aa6f66aab4c76d6997f 100644 (file)
@@ -197,8 +197,9 @@ static void open_placeholder_window(Con *con) {
         /* Set the same name as was stored in the layout file. While perhaps
          * slightly confusing in the first instant, this brings additional
          * clarity to which placeholder is waiting for which actual window. */
-        xcb_change_property(restore_conn, XCB_PROP_MODE_REPLACE, placeholder,
-                            A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(con->name), con->name);
+        if (con->name != NULL)
+            xcb_change_property(restore_conn, XCB_PROP_MODE_REPLACE, placeholder,
+                                A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(con->name), con->name);
         DLOG("Created placeholder window 0x%08x for leaf container %p / %s\n",
              placeholder, con, con->name);
 
index 6afdd806fc52bbcd82b48430d33b35b50ab55f28..e9d069385c3895ad2bb9a337c6c642209c32a042 100644 (file)
@@ -48,7 +48,7 @@ sub verify_split_layout {
 
     is(@{$first->{nodes}}, 0, 'first container has no children');
     is(@{$second->{nodes}}, 0, 'second container has no children (yet)');
-    my $old_name = $second->{name};
+    my $old_id = $second->{id};
 
     cmd $args{split_command};
     cmd 'open';
@@ -60,10 +60,10 @@ sub verify_split_layout {
     $second = $content->[1];
 
     is(@{$first->{nodes}}, 0, 'first container has no children');
-    isnt($second->{name}, $old_name, 'second container was replaced');
+    isnt($second->{id}, $old_id, 'second container was replaced');
     is($second->{layout}, 'splith', 'orientation is horizontal');
     is(@{$second->{nodes}}, 2, 'second container has 2 children');
-    is($second->{nodes}->[0]->{name}, $old_name, 'found old second container');
+    is($second->{nodes}->[0]->{id}, $old_id, 'found old second container');
 }
 
 verify_split_layout(split_command => 'split h');