From: Michael Stapelberg Date: Tue, 15 Jul 2014 08:35:52 +0000 (+0200) Subject: don’t set names corresponding to debug colors, remove “sleep 1”. X-Git-Tag: 4.9~66 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0d656dd05daaa74c0b627b585cbbe8203ec17451;p=i3%2Fi3 don’t set names corresponding to debug colors, remove “sleep 1”. 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 :). --- diff --git a/src/con.c b/src/con.c index 78fe5fef..282c389f 100644 --- a/src/con.c +++ b/src/con.c @@ -13,18 +13,6 @@ */ #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)); diff --git a/src/ipc.c b/src/ipc.c index d6bb34a4..59f0938d 100644 --- 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"); diff --git a/src/load_layout.c b/src/load_layout.c index ee50660b..5fe7c84c 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -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"); diff --git a/src/restore_layout.c b/src/restore_layout.c index d6d7927d..3a657c90 100644 --- a/src/restore_layout.c +++ b/src/restore_layout.c @@ -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); diff --git a/testcases/t/122-split.t b/testcases/t/122-split.t index 6afdd806..e9d06938 100644 --- a/testcases/t/122-split.t +++ b/testcases/t/122-split.t @@ -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');