diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-09-18 06:56:50 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-18 06:56:50 +0900 |
commit | 476274cfbbd44a330583f28f0695c8f2a0793120 (patch) | |
tree | bb9efb20f171de177d7a8924b74df96ac2ceb5fc /sway | |
parent | a7eeb48aace8d88f9c809eee5df93d6cefbb372f (diff) | |
parent | 87080bb9cc5c9fdf9b2bf4cd0257e77231d257ed (diff) |
Merge pull request #904 from zandrmartin/fix-json-tree-focus-property
fix view focus property in get_tree json
Diffstat (limited to 'sway')
-rw-r--r-- | sway/ipc-json.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 3f03b9f1..5d10ff59 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -132,11 +132,9 @@ static void ipc_json_describe_output(swayc_t *output, json_object *object) { static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) { int num = (isdigit(workspace->name[0])) ? atoi(workspace->name) : -1; - bool focused = root_container.focused == workspace->parent && workspace->parent->focused == workspace; const char *layout = ipc_json_layout_description(workspace->layout); json_object_object_add(object, "num", json_object_new_int(num)); - json_object_object_add(object, "focused", json_object_new_boolean(focused)); json_object_object_add(object, "output", (workspace->parent) ? json_object_new_string(workspace->parent->name) : NULL); json_object_object_add(object, "urgent", json_object_new_boolean(false)); json_object_object_add(object, "type", json_object_new_string("workspace")); @@ -171,7 +169,6 @@ static void ipc_json_describe_view(swayc_t *c, json_object *object) { json_object_object_add(object, "percent", (percent > 0) ? json_object_new_double(percent) : NULL); // TODO: make urgency actually work once Sway supports it json_object_object_add(object, "urgent", json_object_new_boolean(false)); - json_object_object_add(object, "focused", json_object_new_boolean(c->is_focused)); json_object_object_add(object, "layout", (strcmp(layout, "null") == 0) ? NULL : json_object_new_string(layout)); @@ -219,6 +216,7 @@ json_object *ipc_json_describe_container(swayc_t *c) { json_object_object_add(object, "name", (c->name) ? json_object_new_string(c->name) : NULL); json_object_object_add(object, "rect", ipc_json_create_rect(c)); json_object_object_add(object, "visible", json_object_new_boolean(c->visible)); + json_object_object_add(object, "focused", json_object_new_boolean(c == current_focus)); switch (c->type) { case C_ROOT: |