Merge pull request #3052 from colemickens/output-current-mode
Correct "Current mode" in `swaymsg -t get_outputs` for scaled outputs
This commit is contained in:
commit
baf4841d79
|
@ -136,13 +136,18 @@ static void ipc_json_describe_output(struct sway_output *output,
|
||||||
json_object_new_int(mode->width));
|
json_object_new_int(mode->width));
|
||||||
json_object_object_add(mode_object, "height",
|
json_object_object_add(mode_object, "height",
|
||||||
json_object_new_int(mode->height));
|
json_object_new_int(mode->height));
|
||||||
json_object_object_add(mode_object, "refresh",
|
|
||||||
json_object_new_int(mode->refresh));
|
|
||||||
json_object_array_add(modes_array, mode_object);
|
json_object_array_add(modes_array, mode_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object_object_add(object, "modes", modes_array);
|
json_object_object_add(object, "modes", modes_array);
|
||||||
|
|
||||||
|
json_object *current_mode_object = json_object_new_object();
|
||||||
|
json_object_object_add(current_mode_object, "width",
|
||||||
|
json_object_new_int(wlr_output->width));
|
||||||
|
json_object_object_add(current_mode_object, "height",
|
||||||
|
json_object_new_int(wlr_output->height));
|
||||||
|
json_object_object_add(object, "current_mode", current_mode_object);
|
||||||
|
|
||||||
struct sway_node *parent = node_get_parent(&output->node);
|
struct sway_node *parent = node_get_parent(&output->node);
|
||||||
struct wlr_box parent_box = {0, 0, 0, 0};
|
struct wlr_box parent_box = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
|
|
@ -183,13 +183,15 @@ static void pretty_print_output(json_object *o) {
|
||||||
json_object_object_get_ex(rect, "height", &height);
|
json_object_object_get_ex(rect, "height", &height);
|
||||||
json_object *modes;
|
json_object *modes;
|
||||||
json_object_object_get_ex(o, "modes", &modes);
|
json_object_object_get_ex(o, "modes", &modes);
|
||||||
|
json_object *current_mode;
|
||||||
|
json_object_object_get_ex(o, "current_mode", ¤t_mode);
|
||||||
|
|
||||||
if (json_object_get_boolean(active)) {
|
if (json_object_get_boolean(active)) {
|
||||||
printf(
|
printf(
|
||||||
"Output %s '%s %s %s'%s\n"
|
"Output %s '%s %s %s'%s\n"
|
||||||
" Current mode: %dx%d @ %f Hz\n"
|
" Current mode: %dx%d @ %f Hz\n"
|
||||||
" Position: %d,%d\n"
|
" Position: %d,%d\n"
|
||||||
" Scale factor: %dx\n"
|
" Scale factor: %f\n"
|
||||||
" Transform: %s\n"
|
" Transform: %s\n"
|
||||||
" Workspace: %s\n",
|
" Workspace: %s\n",
|
||||||
json_object_get_string(name),
|
json_object_get_string(name),
|
||||||
|
@ -197,10 +199,13 @@ static void pretty_print_output(json_object *o) {
|
||||||
json_object_get_string(model),
|
json_object_get_string(model),
|
||||||
json_object_get_string(serial),
|
json_object_get_string(serial),
|
||||||
json_object_get_boolean(focused) ? " (focused)" : "",
|
json_object_get_boolean(focused) ? " (focused)" : "",
|
||||||
json_object_get_int(width), json_object_get_int(height),
|
json_object_get_int(
|
||||||
|
json_object_object_get(current_mode, "width")),
|
||||||
|
json_object_get_int(
|
||||||
|
json_object_object_get(current_mode, "height")),
|
||||||
(float)json_object_get_int(refresh) / 1000,
|
(float)json_object_get_int(refresh) / 1000,
|
||||||
json_object_get_int(x), json_object_get_int(y),
|
json_object_get_int(x), json_object_get_int(y),
|
||||||
json_object_get_int(scale),
|
json_object_get_double(scale),
|
||||||
json_object_get_string(transform),
|
json_object_get_string(transform),
|
||||||
json_object_get_string(ws)
|
json_object_get_string(ws)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue