+ if (strcasecmp(ctx->last_map_key, "align") == 0) {
+ if (len == strlen("left") && !strncmp((const char*)val, "left", strlen("left"))) {
+ ctx->block.align = ALIGN_LEFT;
+ } else if (len == strlen("right") && !strncmp((const char*)val, "right", strlen("right"))) {
+ ctx->block.align = ALIGN_RIGHT;
+ } else {
+ ctx->block.align = ALIGN_CENTER;
+ }
+ } else if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
+ i3String *text = i3string_from_utf8_with_length((const char *)val, len);
+ ctx->block.min_width = (uint32_t)predict_text_width(text);
+ i3string_free(text);
+ }
+ if (strcasecmp(ctx->last_map_key, "name") == 0) {
+ char *copy = (char*)malloc(len+1);
+ strncpy(copy, (const char *)val, len);
+ copy[len] = 0;
+ ctx->block.name = copy;
+ }
+ if (strcasecmp(ctx->last_map_key, "instance") == 0) {
+ char *copy = (char*)malloc(len+1);
+ strncpy(copy, (const char *)val, len);
+ copy[len] = 0;
+ ctx->block.instance = copy;
+ }
+ return 1;
+}
+
+#if YAJL_MAJOR >= 2
+static int stdin_integer(void *context, long long val) {
+#else
+static int stdin_integer(void *context, long val) {
+#endif
+ parser_ctx *ctx = context;
+ if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
+ ctx->block.min_width = (uint32_t)val;
+ }
+ if (strcasecmp(ctx->last_map_key, "separator_block_width") == 0) {
+ ctx->block.sep_block_width = (uint32_t)val;
+ }