aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-09-15 01:51:58 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-09-15 09:42:49 +0100
commit1c292fd43abf1c3bc86e91bd348f690aea820c85 (patch)
treeb2e929f89de3bafe37908d13e3819db2fe1259c6 /sway/ipc-json.c
parentMerge pull request #2630 from emersion/wlroots-1243 (diff)
downloadsway-1c292fd43abf1c3bc86e91bd348f690aea820c85.tar.gz
sway-1c292fd43abf1c3bc86e91bd348f690aea820c85.tar.zst
sway-1c292fd43abf1c3bc86e91bd348f690aea820c85.zip
ipc: add focus information to root node
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 8b786145..30c0a8e1 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -314,9 +314,21 @@ struct focus_inactive_data {
314static void focus_inactive_children_iterator(struct sway_node *node, 314static void focus_inactive_children_iterator(struct sway_node *node,
315 void *_data) { 315 void *_data) {
316 struct focus_inactive_data *data = _data; 316 struct focus_inactive_data *data = _data;
317 if (node_get_parent(node) == data->node) { 317 json_object *focus = data->object;
318 json_object_array_add(data->object, json_object_new_int(node->id)); 318 if (data->node == &root->node) {
319 int len = json_object_array_length(focus);
320 struct sway_output *output = node_get_output(node);
321 size_t id = output->node.id;
322 for (int i = 0; i < len; ++i) {
323 if ((size_t) json_object_get_int(json_object_array_get_idx(focus, i)) == id) {
324 return;
325 }
326 }
327 node = &output->node;
328 } else if (node_get_parent(node) != data->node) {
329 return;
319 } 330 }
331 json_object_array_add(focus, json_object_new_int(node->id));
320} 332}
321 333
322json_object *ipc_json_describe_node(struct sway_node *node) { 334json_object *ipc_json_describe_node(struct sway_node *node) {