diff options
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r-- | sway/ipc-json.c | 22 |
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 | ||
33 | static const char *ipc_json_orientation_description(enum sway_container_layout l) { | 33 | static 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 | ||