}
if (!strcmp(cur_key, "outputs")) {
- printf("+output %.*s\n", len, val);
- /* XXX: these are not implemented yet */
+ DLOG("+output %.*s\n", len, val);
+ int new_num_outputs = config.num_outputs + 1;
+ config.outputs = srealloc(config.outputs, sizeof(char*) * new_num_outputs);
+ asprintf(&config.outputs[config.num_outputs], "%.*s", len, val);
+ config.num_outputs = new_num_outputs;
return 1;
}
i3_output *outputs_walk;
char *cur_key;
char *json;
- bool init;
+ bool in_rect;
};
/*
return 1;
}
+ if (!strcmp(params->cur_key, "rect")) {
+ params->in_rect = true;
+ }
+
return 1;
}
*/
static int outputs_end_map_cb(void *params_) {
struct outputs_json_params *params = (struct outputs_json_params*) params_;
- /* FIXME: What is at the end of a rect? */
+ if (params->in_rect) {
+ params->in_rect = false;
+ /* Ignore the end of a rect */
+ return 1;
+ }
+
+ /* See if we actually handle that output */
+ if (config.num_outputs > 0) {
+ bool handle_output = false;
+ for (int c = 0; c < config.num_outputs; c++) {
+ if (strcasecmp(params->outputs_walk->name, config.outputs[c]) != 0)
+ continue;
+
+ handle_output = true;
+ break;
+ }
+ if (!handle_output) {
+ DLOG("Ignoring output \"%s\", not configured to handle it.\n",
+ params->outputs_walk->name);
+ FREE(params->outputs_walk->name);
+ FREE(params->outputs_walk->workspaces);
+ FREE(params->outputs_walk->trayclients);
+ FREE(params->outputs_walk);
+ FREE(params->cur_key);
+ return 1;
+ }
+ }
i3_output *target = get_output_by_name(params->outputs_walk->name);
params.outputs_walk = NULL;
params.cur_key = NULL;
params.json = json;
+ params.in_rect = false;
yajl_handle handle;
yajl_status state;
output_name = smalloc(sizeof(const unsigned char) * (len + 1));
strncpy(output_name, (const char*) val, len);
output_name[len] = '\0';
- params->workspaces_walk->output = get_output_by_name(output_name);
+ i3_output *target = get_output_by_name(output_name);
+ if (target) {
+ params->workspaces_walk->output = target;
- TAILQ_INSERT_TAIL(params->workspaces_walk->output->workspaces,
- params->workspaces_walk,
- tailq);
+ TAILQ_INSERT_TAIL(params->workspaces_walk->output->workspaces,
+ params->workspaces_walk,
+ tailq);
+ }
FREE(output_name);
return 1;