ipc: make 'layout' a string
This commit is contained in:
@ -131,6 +131,21 @@ static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
|
||||
json_node->border_style = BS_NORMAL;
|
||||
else LOG("Unhandled \"border\": %s\n", buf);
|
||||
free(buf);
|
||||
} else if (strcasecmp(last_key, "layout") == 0) {
|
||||
char *buf = NULL;
|
||||
asprintf(&buf, "%.*s", (int)len, val);
|
||||
if (strcasecmp(buf, "default") == 0)
|
||||
json_node->layout = L_DEFAULT;
|
||||
else if (strcasecmp(buf, "stacked") == 0)
|
||||
json_node->layout = L_STACKED;
|
||||
else if (strcasecmp(buf, "tabbed") == 0)
|
||||
json_node->layout = L_TABBED;
|
||||
else if (strcasecmp(buf, "dockarea") == 0)
|
||||
json_node->layout = L_DOCKAREA;
|
||||
else if (strcasecmp(buf, "output") == 0)
|
||||
json_node->layout = L_OUTPUT;
|
||||
else LOG("Unhandled \"layout\": %s\n", buf);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@ -142,6 +157,7 @@ static int json_int(void *ctx, long long val) {
|
||||
static int json_int(void *ctx, long val) {
|
||||
#endif
|
||||
LOG("int %d for key %s\n", val, last_key);
|
||||
// TODO: remove this after the next preview release
|
||||
if (strcasecmp(last_key, "layout") == 0) {
|
||||
json_node->layout = val;
|
||||
}
|
||||
|
Reference in New Issue
Block a user