aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <ddevault@linode.com>2016-07-28 14:42:39 -0400
committerLibravatar Drew DeVault <ddevault@linode.com>2016-07-28 14:42:39 -0400
commitcad085ed9ddf57ade3785cabfaea9fb49613d4a3 (patch)
treecd95c89b767c8ed008a2465cc281a69dca8ceac1 /sway/ipc-json.c
parentUpdate hidpi support to latest wlc API (diff)
downloadsway-cad085ed9ddf57ade3785cabfaea9fb49613d4a3.tar.gz
sway-cad085ed9ddf57ade3785cabfaea9fb49613d4a3.tar.zst
sway-cad085ed9ddf57ade3785cabfaea9fb49613d4a3.zip
Update IPC JSON responses for HiDPI setups
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c15
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
113static void ipc_json_describe_output(swayc_t *output, json_object *object) { 122static 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
122static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) { 133static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) {