aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-07-29 07:35:43 -0400
committerDrew DeVault <sir@cmpwn.com>2016-07-29 07:35:43 -0400
commit966127222439620233c27ab835062f6cc69e23ea (patch)
tree7e233c68e7063b7c0c7857a73111e95141fb5b44 /sway/ipc-json.c
parentddb44984c5f3aede3eea45403659e5614a7b752f (diff)
parentcad085ed9ddf57ade3785cabfaea9fb49613d4a3 (diff)
Merge remote-tracking branch 'origin/hidpi'
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) {
json_object_object_add(rect, "x", json_object_new_int((int32_t)c->x));
json_object_object_add(rect, "y", json_object_new_int((int32_t)c->y));
- json_object_object_add(rect, "width", json_object_new_int((int32_t)c->width));
- json_object_object_add(rect, "height", json_object_new_int((int32_t)c->height));
+
+ struct wlc_size size;
+ if (c->type == C_OUTPUT) {
+ size = *wlc_output_get_resolution(c->handle);
+ } else {
+ size.w = c->width;
+ size.h = c->height;
+ }
+
+ json_object_object_add(rect, "width", json_object_new_int((int32_t)size.w));
+ json_object_object_add(rect, "height", json_object_new_int((int32_t)size.h));
return rect;
}
@@ -111,12 +120,14 @@ static float ipc_json_child_percentage(swayc_t *c) {
}
static void ipc_json_describe_output(swayc_t *output, json_object *object) {
+ uint32_t scale = wlc_output_get_scale(output->handle);
json_object_object_add(object, "active", json_object_new_boolean(true));
json_object_object_add(object, "primary", json_object_new_boolean(false));
json_object_object_add(object, "layout", json_object_new_string("output"));
json_object_object_add(object, "type", json_object_new_string("output"));
json_object_object_add(object, "current_workspace",
(output->focused) ? json_object_new_string(output->focused->name) : NULL);
+ json_object_object_add(object, "scale", json_object_new_int(scale));
}
static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) {