diff options
author | Drew DeVault <ddevault@linode.com> | 2016-07-28 14:42:39 -0400 |
---|---|---|
committer | Drew DeVault <ddevault@linode.com> | 2016-07-28 14:42:39 -0400 |
commit | cad085ed9ddf57ade3785cabfaea9fb49613d4a3 (patch) | |
tree | cd95c89b767c8ed008a2465cc281a69dca8ceac1 /sway | |
parent | Update hidpi support to latest wlc API (diff) | |
download | sway-cad085ed9ddf57ade3785cabfaea9fb49613d4a3.tar.gz sway-cad085ed9ddf57ade3785cabfaea9fb49613d4a3.tar.zst sway-cad085ed9ddf57ade3785cabfaea9fb49613d4a3.zip |
Update IPC JSON responses for HiDPI setups
Diffstat (limited to 'sway')
-rw-r--r-- | sway/ipc-json.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 4e5ea896..228e551d 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -11,8 +11,17 @@ static json_object *ipc_json_create_rect(swayc_t *c) { | |||
11 | 11 | ||
12 | json_object_object_add(rect, "x", json_object_new_int((int32_t)c->x)); | 12 | json_object_object_add(rect, "x", json_object_new_int((int32_t)c->x)); |
13 | json_object_object_add(rect, "y", json_object_new_int((int32_t)c->y)); | 13 | json_object_object_add(rect, "y", json_object_new_int((int32_t)c->y)); |
14 | json_object_object_add(rect, "width", json_object_new_int((int32_t)c->width)); | 14 | |
15 | json_object_object_add(rect, "height", json_object_new_int((int32_t)c->height)); | 15 | struct wlc_size size; |
16 | if (c->type == C_OUTPUT) { | ||
17 | size = *wlc_output_get_resolution(c->handle); | ||
18 | } else { | ||
19 | size.w = c->width; | ||
20 | size.h = c->height; | ||
21 | } | ||
22 | |||
23 | json_object_object_add(rect, "width", json_object_new_int((int32_t)size.w)); | ||
24 | json_object_object_add(rect, "height", json_object_new_int((int32_t)size.h)); | ||
16 | 25 | ||
17 | return rect; | 26 | return rect; |
18 | } | 27 | } |
@@ -111,12 +120,14 @@ static float ipc_json_child_percentage(swayc_t *c) { | |||
111 | } | 120 | } |
112 | 121 | ||
113 | static void ipc_json_describe_output(swayc_t *output, json_object *object) { | 122 | static void ipc_json_describe_output(swayc_t *output, json_object *object) { |
123 | uint32_t scale = wlc_output_get_scale(output->handle); | ||
114 | json_object_object_add(object, "active", json_object_new_boolean(true)); | 124 | json_object_object_add(object, "active", json_object_new_boolean(true)); |
115 | json_object_object_add(object, "primary", json_object_new_boolean(false)); | 125 | json_object_object_add(object, "primary", json_object_new_boolean(false)); |
116 | json_object_object_add(object, "layout", json_object_new_string("output")); | 126 | json_object_object_add(object, "layout", json_object_new_string("output")); |
117 | json_object_object_add(object, "type", json_object_new_string("output")); | 127 | json_object_object_add(object, "type", json_object_new_string("output")); |
118 | json_object_object_add(object, "current_workspace", | 128 | json_object_object_add(object, "current_workspace", |
119 | (output->focused) ? json_object_new_string(output->focused->name) : NULL); | 129 | (output->focused) ? json_object_new_string(output->focused->name) : NULL); |
130 | json_object_object_add(object, "scale", json_object_new_int(scale)); | ||
120 | } | 131 | } |
121 | 132 | ||
122 | static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) { | 133 | static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) { |