summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-11-03 17:37:15 +0100
committerLibravatar GitHub <noreply@github.com>2018-11-03 17:37:15 +0100
commitbaf4841d790a976bc6293b9b5d1e70621f236747 (patch)
tree5dfe97b2acfe005b74fc23fa4db8ab04b91aa747
parentCorrection to dependency updates (diff)
parentswaymsg: get_outputs: use output->current_mode for current mode display (diff)
downloadsway-baf4841d790a976bc6293b9b5d1e70621f236747.tar.gz
sway-baf4841d790a976bc6293b9b5d1e70621f236747.tar.zst
sway-baf4841d790a976bc6293b9b5d1e70621f236747.zip
Merge pull request #3052 from colemickens/output-current-mode
Correct "Current mode" in `swaymsg -t get_outputs` for scaled outputs
-rw-r--r--sway/ipc-json.c9
-rw-r--r--swaymsg/main.c11
2 files changed, 15 insertions, 5 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 20ab57b4..7cc965c8 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -136,13 +136,18 @@ static void ipc_json_describe_output(struct sway_output *output,
136 json_object_new_int(mode->width)); 136 json_object_new_int(mode->width));
137 json_object_object_add(mode_object, "height", 137 json_object_object_add(mode_object, "height",
138 json_object_new_int(mode->height)); 138 json_object_new_int(mode->height));
139 json_object_object_add(mode_object, "refresh",
140 json_object_new_int(mode->refresh));
141 json_object_array_add(modes_array, mode_object); 139 json_object_array_add(modes_array, mode_object);
142 } 140 }
143 141
144 json_object_object_add(object, "modes", modes_array); 142 json_object_object_add(object, "modes", modes_array);
145 143
144 json_object *current_mode_object = json_object_new_object();
145 json_object_object_add(current_mode_object, "width",
146 json_object_new_int(wlr_output->width));
147 json_object_object_add(current_mode_object, "height",
148 json_object_new_int(wlr_output->height));
149 json_object_object_add(object, "current_mode", current_mode_object);
150
146 struct sway_node *parent = node_get_parent(&output->node); 151 struct sway_node *parent = node_get_parent(&output->node);
147 struct wlr_box parent_box = {0, 0, 0, 0}; 152 struct wlr_box parent_box = {0, 0, 0, 0};
148 153
diff --git a/swaymsg/main.c b/swaymsg/main.c
index 3c984225..e13dd7ec 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -183,13 +183,15 @@ static void pretty_print_output(json_object *o) {
183 json_object_object_get_ex(rect, "height", &height); 183 json_object_object_get_ex(rect, "height", &height);
184 json_object *modes; 184 json_object *modes;
185 json_object_object_get_ex(o, "modes", &modes); 185 json_object_object_get_ex(o, "modes", &modes);
186 json_object *current_mode;
187 json_object_object_get_ex(o, "current_mode", &current_mode);
186 188
187 if (json_object_get_boolean(active)) { 189 if (json_object_get_boolean(active)) {
188 printf( 190 printf(
189 "Output %s '%s %s %s'%s\n" 191 "Output %s '%s %s %s'%s\n"
190 " Current mode: %dx%d @ %f Hz\n" 192 " Current mode: %dx%d @ %f Hz\n"
191 " Position: %d,%d\n" 193 " Position: %d,%d\n"
192 " Scale factor: %dx\n" 194 " Scale factor: %f\n"
193 " Transform: %s\n" 195 " Transform: %s\n"
194 " Workspace: %s\n", 196 " Workspace: %s\n",
195 json_object_get_string(name), 197 json_object_get_string(name),
@@ -197,10 +199,13 @@ static void pretty_print_output(json_object *o) {
197 json_object_get_string(model), 199 json_object_get_string(model),
198 json_object_get_string(serial), 200 json_object_get_string(serial),
199 json_object_get_boolean(focused) ? " (focused)" : "", 201 json_object_get_boolean(focused) ? " (focused)" : "",
200 json_object_get_int(width), json_object_get_int(height), 202 json_object_get_int(
203 json_object_object_get(current_mode, "width")),
204 json_object_get_int(
205 json_object_object_get(current_mode, "height")),
201 (float)json_object_get_int(refresh) / 1000, 206 (float)json_object_get_int(refresh) / 1000,
202 json_object_get_int(x), json_object_get_int(y), 207 json_object_get_int(x), json_object_get_int(y),
203 json_object_get_int(scale), 208 json_object_get_double(scale),
204 json_object_get_string(transform), 209 json_object_get_string(transform),
205 json_object_get_string(ws) 210 json_object_get_string(ws)
206 ); 211 );