Export output ports via IPC

This commit is contained in:
Simon Ser 2023-02-28 13:05:37 +01:00
parent 2ace2fea95
commit 4e3a6015e8
2 changed files with 7 additions and 1 deletions

View file

@ -300,6 +300,7 @@ static void ipc_json_describe_wlr_output(struct wlr_output *wlr_output, json_obj
json_object_new_string(wlr_output->model ? wlr_output->model : "Unknown")); json_object_new_string(wlr_output->model ? wlr_output->model : "Unknown"));
json_object_object_add(object, "serial", json_object_object_add(object, "serial",
json_object_new_string(wlr_output->serial ? wlr_output->serial : "Unknown")); json_object_new_string(wlr_output->serial ? wlr_output->serial : "Unknown"));
json_object_object_add(object, "port", json_object_new_string(wlr_output->port));
json_object *modes_array = json_object_new_array(); json_object *modes_array = json_object_new_array();
struct wlr_output_mode *mode; struct wlr_output_mode *mode;

View file

@ -193,11 +193,12 @@ static void pretty_print_output(json_object *o) {
json_object_object_get_ex(o, "power", &power); json_object_object_get_ex(o, "power", &power);
json_object_object_get_ex(o, "current_workspace", &ws); json_object_object_get_ex(o, "current_workspace", &ws);
json_object_object_get_ex(o, "non_desktop", &non_desktop); json_object_object_get_ex(o, "non_desktop", &non_desktop);
json_object *make, *model, *serial, *scale, *scale_filter, *subpixel, json_object *make, *model, *serial, *port, *scale, *scale_filter, *subpixel,
*transform, *max_render_time, *adaptive_sync_status; *transform, *max_render_time, *adaptive_sync_status;
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, "port", &port);
json_object_object_get_ex(o, "scale", &scale); json_object_object_get_ex(o, "scale", &scale);
json_object_object_get_ex(o, "scale_filter", &scale_filter); json_object_object_get_ex(o, "scale_filter", &scale_filter);
json_object_object_get_ex(o, "subpixel_hinting", &subpixel); json_object_object_get_ex(o, "subpixel_hinting", &subpixel);
@ -267,6 +268,10 @@ static void pretty_print_output(json_object *o) {
); );
} }
if (port != NULL) {
printf(" Port: %s\n", json_object_get_string(port));
}
size_t modes_len = json_object_is_type(modes, json_type_array) size_t modes_len = json_object_is_type(modes, json_type_array)
? json_object_array_length(modes) : 0; ? json_object_array_length(modes) : 0;
if (modes_len > 0) { if (modes_len > 0) {