mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 09:51:29 +00:00
ipc/tree: populate focus
fields
Ids of children, by order of focus
This commit is contained in:
parent
661625b29e
commit
fd7c4bacbd
|
@ -454,21 +454,50 @@ json_object *ipc_json_describe_container_recursive(swayc_t *c) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
json_object *floating = json_object_new_array();
|
json_object *floating = json_object_new_array();
|
||||||
if (c->type != C_VIEW && c->floating && c->floating->length > 0) {
|
if (c->type != C_VIEW && c->floating) {
|
||||||
for (i = 0; i < c->floating->length; ++i) {
|
for (i = 0; i < c->floating->length; ++i) {
|
||||||
json_object_array_add(floating, ipc_json_describe_container_recursive(c->floating->items[i]));
|
swayc_t *item = c->floating->items[i];
|
||||||
|
json_object_array_add(floating, ipc_json_describe_container_recursive(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json_object_object_add(object, "floating_nodes", floating);
|
json_object_object_add(object, "floating_nodes", floating);
|
||||||
|
|
||||||
json_object *children = json_object_new_array();
|
json_object *children = json_object_new_array();
|
||||||
if (c->type != C_VIEW && c->children && c->children->length > 0) {
|
if (c->type != C_VIEW && c->children) {
|
||||||
for (i = 0; i < c->children->length; ++i) {
|
for (i = 0; i < c->children->length; ++i) {
|
||||||
json_object_array_add(children, ipc_json_describe_container_recursive(c->children->items[i]));
|
json_object_array_add(children, ipc_json_describe_container_recursive(c->children->items[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json_object_object_add(object, "nodes", children);
|
json_object_object_add(object, "nodes", children);
|
||||||
|
|
||||||
|
json_object *focus = json_object_new_array();
|
||||||
|
if (c->type != C_VIEW) {
|
||||||
|
if (c->focused) {
|
||||||
|
json_object_array_add(focus, json_object_new_double(c->focused->id));
|
||||||
|
}
|
||||||
|
if (c->floating) {
|
||||||
|
for (i = 0; i < c->floating->length; ++i) {
|
||||||
|
swayc_t *item = c->floating->items[i];
|
||||||
|
if (item == c->focused) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
json_object_array_add(focus, json_object_new_double(item->id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c->children) {
|
||||||
|
for (i = 0; i < c->children->length; ++i) {
|
||||||
|
swayc_t *item = c->children->items[i];
|
||||||
|
if (item == c->focused) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
json_object_array_add(focus, json_object_new_double(item->id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
json_object_object_add(object, "focus", focus);
|
||||||
|
|
||||||
if (c->type == C_ROOT) {
|
if (c->type == C_ROOT) {
|
||||||
json_object *scratchpad_json = json_object_new_array();
|
json_object *scratchpad_json = json_object_new_array();
|
||||||
if (scratchpad->length > 0) {
|
if (scratchpad->length > 0) {
|
||||||
|
|
Loading…
Reference in a new issue