]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/child.c
Merge branch 'master' into next
[i3/i3] / i3bar / src / child.c
index 2bf65510658cd80934feb018469baedbbab102a3..d0f0c5fbc67deb004a66f73752e1b2c4a533038c 100644 (file)
@@ -188,12 +188,12 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) {
         sasprintf(&(ctx->block.color), "%.*s", len, val);
     }
     if (strcasecmp(ctx->last_map_key, "align") == 0) {
-        if (len == strlen("left") && !strncmp((const char *)val, "left", strlen("left"))) {
-            ctx->block.align = ALIGN_LEFT;
+        if (len == strlen("center") && !strncmp((const char *)val, "center", strlen("center"))) {
+            ctx->block.align = ALIGN_CENTER;
         } else if (len == strlen("right") && !strncmp((const char *)val, "right", strlen("right"))) {
             ctx->block.align = ALIGN_RIGHT;
         } else {
-            ctx->block.align = ALIGN_CENTER;
+            ctx->block.align = ALIGN_LEFT;
         }
     } else if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
         i3String *text = i3string_from_utf8_with_length((const char *)val, len);
@@ -233,7 +233,7 @@ static int stdin_end_map(void *context) {
     /* Ensure we have a full_text set, so that when it is missing (or null),
      * i3bar doesn’t crash and the user gets an annoying message. */
     if (!new_block->full_text)
-        new_block->full_text = i3string_from_utf8("SPEC VIOLATION (null)");
+        new_block->full_text = i3string_from_utf8("SPEC VIOLATION: full_text is NULL!");
     if (new_block->urgent)
         ctx->has_urgent = true;
     TAILQ_INSERT_TAIL(&statusline_head, new_block, blocks);
@@ -371,7 +371,7 @@ void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
         if (config.hide_on_modifier) {
             stop_child();
         }
-        read_json_input(buffer + consumed, rec - consumed);
+        draw_bars(read_json_input(buffer + consumed, rec - consumed));
     } else {
         /* In case of plaintext, we just add a single block and change its
          * full_text pointer later. */
@@ -520,33 +520,35 @@ void child_click_events_key(const char *key) {
  *
  */
 void send_block_clicked(int button, const char *name, const char *instance, int x, int y) {
-    if (child.click_events) {
-        child_click_events_initialize();
+    if (!child.click_events) {
+        return;
+    }
 
-        yajl_gen_map_open(gen);
+    child_click_events_initialize();
 
-        if (name) {
-            child_click_events_key("name");
-            yajl_gen_string(gen, (const unsigned char *)name, strlen(name));
-        }
+    yajl_gen_map_open(gen);
 
-        if (instance) {
-            child_click_events_key("instance");
-            yajl_gen_string(gen, (const unsigned char *)instance, strlen(instance));
-        }
+    if (name) {
+        child_click_events_key("name");
+        yajl_gen_string(gen, (const unsigned char *)name, strlen(name));
+    }
 
-        child_click_events_key("button");
-        yajl_gen_integer(gen, button);
+    if (instance) {
+        child_click_events_key("instance");
+        yajl_gen_string(gen, (const unsigned char *)instance, strlen(instance));
+    }
 
-        child_click_events_key("x");
-        yajl_gen_integer(gen, x);
+    child_click_events_key("button");
+    yajl_gen_integer(gen, button);
 
-        child_click_events_key("y");
-        yajl_gen_integer(gen, y);
+    child_click_events_key("x");
+    yajl_gen_integer(gen, x);
 
-        yajl_gen_map_close(gen);
-        child_write_output();
-    }
+    child_click_events_key("y");
+    yajl_gen_integer(gen, y);
+
+    yajl_gen_map_close(gen);
+    child_write_output();
 }
 
 /*