aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Zandr Martin <zandrmartin@gmail.com>2016-10-02 22:21:16 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-10-04 17:25:10 -0400
commit9a74abc38a1e2f20314dd618ee9dcca2d1804fa3 (patch)
treeaa2a8b04784a6af60194c838bec3cddd0bc1d7d0
parentmoved ipc_init above config file processing. (diff)
downloadsway-9a74abc38a1e2f20314dd618ee9dcca2d1804fa3.tar.gz
sway-9a74abc38a1e2f20314dd618ee9dcca2d1804fa3.tar.zst
sway-9a74abc38a1e2f20314dd618ee9dcca2d1804fa3.zip
consolidate nodes json
-rw-r--r--sway/ipc-json.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index e08b3c60..eb77a654 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -199,8 +199,6 @@ static void ipc_json_describe_view(swayc_t *c, json_object *object) {
199 c->is_floating ? "auto_on" : "auto_off")); // we can't state the cause 199 c->is_floating ? "auto_on" : "auto_off")); // we can't state the cause
200 200
201 json_object_object_add(object, "app_id", c->app_id ? json_object_new_string(c->app_id) : NULL); 201 json_object_object_add(object, "app_id", c->app_id ? json_object_new_string(c->app_id) : NULL);
202 json_object_object_add(object, "nodes", json_object_new_array());
203 json_object_object_add(object, "floating_nodes", json_object_new_array());
204} 202}
205 203
206json_object *ipc_json_describe_container(swayc_t *c) { 204json_object *ipc_json_describe_container(swayc_t *c) {
@@ -354,23 +352,21 @@ json_object *ipc_json_describe_container_recursive(swayc_t *c) {
354 json_object *object = ipc_json_describe_container(c); 352 json_object *object = ipc_json_describe_container(c);
355 int i; 353 int i;
356 354
357 if (c->type != C_VIEW) { 355 json_object *floating = json_object_new_array();
358 json_object *floating = json_object_new_array(); 356 if (c->type != C_VIEW && c->floating && c->floating->length > 0) {
359 if (c->floating && c->floating->length > 0) { 357 for (i = 0; i < c->floating->length; ++i) {
360 for (i = 0; i < c->floating->length; ++i) { 358 json_object_array_add(floating, ipc_json_describe_container_recursive(c->floating->items[i]));
361 json_object_array_add(floating, ipc_json_describe_container_recursive(c->floating->items[i]));
362 }
363 } 359 }
364 json_object_object_add(object, "floating_nodes", floating); 360 }
361 json_object_object_add(object, "floating_nodes", floating);
365 362
366 json_object *children = json_object_new_array(); 363 json_object *children = json_object_new_array();
367 if (c->children && c->children->length > 0) { 364 if (c->type != C_VIEW && c->children && c->children->length > 0) {
368 for (i = 0; i < c->children->length; ++i) { 365 for (i = 0; i < c->children->length; ++i) {
369 json_object_array_add(children, ipc_json_describe_container_recursive(c->children->items[i])); 366 json_object_array_add(children, ipc_json_describe_container_recursive(c->children->items[i]));
370 }
371 } 367 }
372 json_object_object_add(object, "nodes", children);
373 } 368 }
369 json_object_object_add(object, "nodes", children);
374 370
375 if (c->type == C_ROOT) { 371 if (c->type == C_ROOT) {
376 json_object *scratchpad_json = json_object_new_array(); 372 json_object *scratchpad_json = json_object_new_array();