diff options
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r-- | sway/ipc-json.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 6ab63c75..064509c9 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <libinput.h> | 5 | #include <libinput.h> |
6 | #include <wlr/types/wlr_box.h> | ||
7 | #include <wlr/types/wlr_output.h> | ||
6 | #include "sway/container.h" | 8 | #include "sway/container.h" |
7 | #include "sway/input.h" | 9 | #include "sway/input.h" |
8 | #include "sway/ipc-json.h" | 10 | #include "sway/ipc-json.h" |
@@ -14,16 +16,19 @@ static json_object *ipc_json_create_rect(swayc_t *c) { | |||
14 | json_object_object_add(rect, "x", json_object_new_int((int32_t)c->x)); | 16 | json_object_object_add(rect, "x", json_object_new_int((int32_t)c->x)); |
15 | json_object_object_add(rect, "y", json_object_new_int((int32_t)c->y)); | 17 | json_object_object_add(rect, "y", json_object_new_int((int32_t)c->y)); |
16 | 18 | ||
17 | struct wlc_size size; | 19 | struct wlr_box box; |
18 | if (c->type == C_OUTPUT) { | 20 | if (c->type == C_OUTPUT) { |
19 | size = *wlc_output_get_resolution(c->handle); | 21 | wlr_output_effective_resolution(c->_handle.output, |
22 | &box.width, &box.height); | ||
20 | } else { | 23 | } else { |
21 | size.w = c->width; | 24 | box.width = c->width; |
22 | size.h = c->height; | 25 | box.width = c->height; |
23 | } | 26 | } |
24 | 27 | ||
25 | json_object_object_add(rect, "width", json_object_new_int((int32_t)size.w)); | 28 | json_object_object_add(rect, "width", |
26 | json_object_object_add(rect, "height", json_object_new_int((int32_t)size.h)); | 29 | json_object_new_int((int32_t)box.width)); |
30 | json_object_object_add(rect, "height", | ||
31 | json_object_new_int((int32_t)box.height)); | ||
27 | 32 | ||
28 | return rect; | 33 | return rect; |
29 | } | 34 | } |