aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Armin Preiml <apreiml@strohwolke.at>2018-09-08 13:11:38 +0200
committerLibravatar Armin Preiml <apreiml@strohwolke.at>2018-09-08 13:24:01 +0200
commit7919ae5e44bc461f3eedaa7ac77f7e4da6b8b28e (patch)
treed05b500406a4ac4222957a2f05933733cc686d9d /sway/ipc-json.c
parentget_tree: percent cast to double on division (diff)
downloadsway-7919ae5e44bc461f3eedaa7ac77f7e4da6b8b28e.tar.gz
sway-7919ae5e44bc461f3eedaa7ac77f7e4da6b8b28e.tar.zst
sway-7919ae5e44bc461f3eedaa7ac77f7e4da6b8b28e.zip
code style fixes
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 682186d5..8b786145 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -31,16 +31,14 @@ static const char *ipc_json_layout_description(enum sway_container_layout l) {
31} 31}
32 32
33static const char *ipc_json_orientation_description(enum sway_container_layout l) { 33static const char *ipc_json_orientation_description(enum sway_container_layout l) {
34 switch (l) { 34 if (l == L_VERT) {
35 case L_VERT:
36 return "vertical"; 35 return "vertical";
37 case L_HORIZ: 36 }
37
38 if (l == L_HORIZ) {
38 return "horizontal"; 39 return "horizontal";
39 case L_TABBED:
40 case L_STACKED:
41 case L_NONE:
42 break;
43 } 40 }
41
44 return "none"; 42 return "none";
45} 43}
46 44
@@ -153,8 +151,8 @@ static void ipc_json_describe_output(struct sway_output *output,
153 } 151 }
154 152
155 if (parent_box.width != 0 && parent_box.height != 0) { 153 if (parent_box.width != 0 && parent_box.height != 0) {
156 double percent = ((double)output->width / (double)parent_box.width) 154 double percent = ((double)output->width / parent_box.width)
157 * ((double)output->height / (double)parent_box.height); 155 * ((double)output->height / parent_box.height);
158 json_object_object_add(object, "percent", json_object_new_double(percent)); 156 json_object_object_add(object, "percent", json_object_new_double(percent));
159 } 157 }
160} 158}
@@ -257,7 +255,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
257 255
258 json_object_object_add(object, "deco_rect", ipc_json_create_rect(&deco_box)); 256 json_object_object_add(object, "deco_rect", ipc_json_create_rect(&deco_box));
259 257
260 struct wlr_box geometry = {0, 0, c->view->natural_width, c->view->natural_height }; 258 struct wlr_box geometry = {0, 0, c->view->natural_width, c->view->natural_height};
261 json_object_object_add(object, "geometry", ipc_json_create_rect(&geometry)); 259 json_object_object_add(object, "geometry", ipc_json_create_rect(&geometry));
262 260
263#ifdef HAVE_XWAYLAND 261#ifdef HAVE_XWAYLAND
@@ -292,8 +290,8 @@ static void ipc_json_describe_container(struct sway_container *c, json_object *o
292 } 290 }
293 291
294 if (parent_box.width != 0 && parent_box.height != 0) { 292 if (parent_box.width != 0 && parent_box.height != 0) {
295 double percent = ((double)c->width / (double)parent_box.width) 293 double percent = ((double)c->width / parent_box.width)
296 * ((double)c->height / (double)parent_box.height); 294 * ((double)c->height / parent_box.height);
297 json_object_object_add(object, "percent", json_object_new_double(percent)); 295 json_object_object_add(object, "percent", json_object_new_double(percent));
298 } 296 }
299 297