summaryrefslogtreecommitdiffstats
path: root/swaygrab
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-12-17 15:52:34 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-12-17 15:52:34 -0500
commitd0bd0ed59887fdbcbe0630c23e5d1cc6a254340c (patch)
tree4444227f247f9b7cdb854144eb4332e607c34987 /swaygrab
parentMerge remote-tracking branch 'besser82/bugfix/json-c' into 0.15 (diff)
downloadsway-d0bd0ed59887fdbcbe0630c23e5d1cc6a254340c.tar.gz
sway-d0bd0ed59887fdbcbe0630c23e5d1cc6a254340c.tar.zst
sway-d0bd0ed59887fdbcbe0630c23e5d1cc6a254340c.zip
Revert "Merge remote-tracking branch 'besser82/bugfix/json-c' into 0.15"
Diffstat (limited to 'swaygrab')
-rw-r--r--swaygrab/json.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/swaygrab/json.c b/swaygrab/json.c
index f0e8fa90..286085c3 100644
--- a/swaygrab/json.c
+++ b/swaygrab/json.c
@@ -50,7 +50,8 @@ static json_object *get_focused_container_r(json_object *c) {
50 } else { 50 } else {
51 json_object *nodes, *node, *child; 51 json_object *nodes, *node, *child;
52 json_object_object_get_ex(c, "nodes", &nodes); 52 json_object_object_get_ex(c, "nodes", &nodes);
53 for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) { 53 int i;
54 for (i = 0; i < json_object_array_length(nodes); i++) {
54 node = json_object_array_get_idx(nodes, i); 55 node = json_object_array_get_idx(nodes, i);
55 56
56 if ((child = get_focused_container_r(node))) { 57 if ((child = get_focused_container_r(node))) {
@@ -59,7 +60,7 @@ static json_object *get_focused_container_r(json_object *c) {
59 } 60 }
60 61
61 json_object_object_get_ex(c, "floating_nodes", &nodes); 62 json_object_object_get_ex(c, "floating_nodes", &nodes);
62 for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) { 63 for (i = 0; i < json_object_array_length(nodes); i++) {
63 node = json_object_array_get_idx(nodes, i); 64 node = json_object_array_get_idx(nodes, i);
64 65
65 if ((child = get_focused_container_r(node))) { 66 if ((child = get_focused_container_r(node))) {
@@ -82,7 +83,7 @@ char *get_focused_output() {
82 if (!outputs) { 83 if (!outputs) {
83 sway_abort("Unabled to get focused output. No nodes in tree."); 84 sway_abort("Unabled to get focused output. No nodes in tree.");
84 } 85 }
85 for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) { 86 for (int i = 0; i < json_object_array_length(outputs); i++) {
86 output = json_object_array_get_idx(outputs, i); 87 output = json_object_array_get_idx(outputs, i);
87 88
88 if (get_focused_container_r(output)) { 89 if (get_focused_container_r(output)) {
@@ -130,7 +131,7 @@ json_object *get_output_container(const char *output) {
130 json_object *outputs, *json_output, *name; 131 json_object *outputs, *json_output, *name;
131 json_object_object_get_ex(tree, "nodes", &outputs); 132 json_object_object_get_ex(tree, "nodes", &outputs);
132 133
133 for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) { 134 for (int i = 0; i < json_object_array_length(outputs); i++) {
134 json_output = json_object_array_get_idx(outputs, i); 135 json_output = json_object_array_get_idx(outputs, i);
135 json_object_object_get_ex(json_output, "name", &name); 136 json_object_object_get_ex(json_output, "name", &name);
136 137