Add output power state to get_outputs ipc command

I forgot to plumb this through when I did the initial state on the
output power state.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
pull/201/head
Jim Ramsay 2022-12-06 20:03:06 -05:00
parent cb116cc980
commit 00539935ba
3 changed files with 6 additions and 2 deletions

View File

@ -33,6 +33,7 @@ struct ctl_server_output {
unsigned height;
unsigned width;
bool captured;
char power[8];
};
struct ctl_server_actions {

View File

@ -380,12 +380,13 @@ static struct cmd_response* generate_output_list(struct ctl* self)
response->data = json_array();
for (size_t i = 0; i < num_outputs; ++i)
json_array_append_new(response->data, json_pack(
"{s:s, s:s, s:i, s:i, s:b}",
"{s:s, s:s, s:i, s:i, s:b, s:s}",
"name", outputs[i].name,
"description", outputs[i].description,
"height", outputs[i].height,
"width", outputs[i].width,
"captured", outputs[i].captured));
"captured", outputs[i].captured,
"power", outputs[i].power));
free(outputs);
return response;
}

View File

@ -537,6 +537,8 @@ static int get_output_list(struct ctl* ctl,
item->height = output->height;
item->width = output->width;
item->captured = (output->id == self->selected_output->id);
strlcpy(item->power, output_power_state_name(output->power),
sizeof(item->power));
item++;
}
return n;