diff options
author | 2016-07-29 07:35:43 -0400 | |
---|---|---|
committer | 2016-07-29 07:35:43 -0400 | |
commit | 966127222439620233c27ab835062f6cc69e23ea (patch) | |
tree | 7e233c68e7063b7c0c7857a73111e95141fb5b44 /sway/ipc-json.c | |
parent | Merge pull request #802 from acrisci/feature/timestamp-log-messages (diff) | |
parent | Update IPC JSON responses for HiDPI setups (diff) | |
download | sway-966127222439620233c27ab835062f6cc69e23ea.tar.gz sway-966127222439620233c27ab835062f6cc69e23ea.tar.zst sway-966127222439620233c27ab835062f6cc69e23ea.zip |
Merge remote-tracking branch 'origin/hidpi'0.9-rc2
Diffstat (limited to 'sway/ipc-json.c')
-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) { |