Add max_render_time to output JSON

This commit is contained in:
Ivan Molodetskikh 2019-09-25 17:55:30 +03:00 committed by Simon Ser
parent bd9a53f1a3
commit fe84ec2f24
2 changed files with 8 additions and 2 deletions

View file

@ -224,6 +224,8 @@ static void ipc_json_describe_output(struct sway_output *output,
* ((double)output->height / parent_box.height); * ((double)output->height / parent_box.height);
json_object_object_add(object, "percent", json_object_new_double(percent)); json_object_object_add(object, "percent", json_object_new_double(percent));
} }
json_object_object_add(object, "max_render_time", json_object_new_int(output->max_render_time));
} }
json_object *ipc_json_describe_disabled_output(struct sway_output *output) { json_object *ipc_json_describe_disabled_output(struct sway_output *output) {

View file

@ -189,13 +189,14 @@ static void pretty_print_output(json_object *o) {
json_object_object_get_ex(o, "focused", &focused); json_object_object_get_ex(o, "focused", &focused);
json_object_object_get_ex(o, "active", &active); json_object_object_get_ex(o, "active", &active);
json_object_object_get_ex(o, "current_workspace", &ws); json_object_object_get_ex(o, "current_workspace", &ws);
json_object *make, *model, *serial, *scale, *subpixel, *transform; json_object *make, *model, *serial, *scale, *subpixel, *transform, *max_render_time;
json_object_object_get_ex(o, "make", &make); json_object_object_get_ex(o, "make", &make);
json_object_object_get_ex(o, "model", &model); json_object_object_get_ex(o, "model", &model);
json_object_object_get_ex(o, "serial", &serial); json_object_object_get_ex(o, "serial", &serial);
json_object_object_get_ex(o, "scale", &scale); json_object_object_get_ex(o, "scale", &scale);
json_object_object_get_ex(o, "subpixel_hinting", &subpixel); json_object_object_get_ex(o, "subpixel_hinting", &subpixel);
json_object_object_get_ex(o, "transform", &transform); json_object_object_get_ex(o, "transform", &transform);
json_object_object_get_ex(o, "max_render_time", &max_render_time);
json_object *x, *y; json_object *x, *y;
json_object_object_get_ex(rect, "x", &x); json_object_object_get_ex(rect, "x", &x);
json_object_object_get_ex(rect, "y", &y); json_object_object_get_ex(rect, "y", &y);
@ -215,7 +216,8 @@ static void pretty_print_output(json_object *o) {
" Scale factor: %f\n" " Scale factor: %f\n"
" Subpixel hinting: %s\n" " Subpixel hinting: %s\n"
" Transform: %s\n" " Transform: %s\n"
" Workspace: %s\n", " Workspace: %s\n"
" Max render time: ",
json_object_get_string(name), json_object_get_string(name),
json_object_get_string(make), json_object_get_string(make),
json_object_get_string(model), json_object_get_string(model),
@ -230,6 +232,8 @@ static void pretty_print_output(json_object *o) {
json_object_get_string(transform), json_object_get_string(transform),
json_object_get_string(ws) json_object_get_string(ws)
); );
int max_render_time_int = json_object_get_int(max_render_time);
printf(max_render_time_int == 0 ? "off\n" : "%d ms\n", max_render_time_int);
} else { } else {
printf( printf(
"Output %s '%s %s %s' (inactive)\n", "Output %s '%s %s %s' (inactive)\n",