output: turn make/model/serial into char *

This allows the make/model/serial to be NULL when unset, and allows
them to be longer than the hardcoded array length.

This is a breaking change: compositors need to handle the new NULL
case, and we stop setting make/model to useless "headless" or
"wayland" strings.
This commit is contained in:
Simon Ser 2022-05-23 10:32:26 +02:00 committed by Simon Zeni
parent 2e69eb1030
commit be86145322
7 changed files with 49 additions and 26 deletions

View file

@ -17,9 +17,20 @@
static void send_geometry(struct wl_resource *resource) {
struct wlr_output *output = wlr_output_from_resource(resource);
const char *make = output->make;
if (make == NULL) {
make = "Unknown";
}
const char *model = output->model;
if (model == NULL) {
model = "Unknown";
}
wl_output_send_geometry(resource, 0, 0,
output->phys_width, output->phys_height, output->subpixel,
output->make, output->model, output->transform);
make, model, output->transform);
}
static void send_current_mode(struct wl_resource *resource) {

View file

@ -767,13 +767,13 @@ static void manager_send_head(struct wlr_output_manager_v1 *manager,
output->phys_width, output->phys_height);
}
if (version >= ZWLR_OUTPUT_HEAD_V1_MAKE_SINCE_VERSION && output->make[0] != '\0') {
if (version >= ZWLR_OUTPUT_HEAD_V1_MAKE_SINCE_VERSION && output->make != NULL) {
zwlr_output_head_v1_send_make(head_resource, output->make);
}
if (version >= ZWLR_OUTPUT_HEAD_V1_MODEL_SINCE_VERSION && output->model[0] != '\0') {
if (version >= ZWLR_OUTPUT_HEAD_V1_MODEL_SINCE_VERSION && output->model != NULL) {
zwlr_output_head_v1_send_model(head_resource, output->model);
}
if (version >= ZWLR_OUTPUT_HEAD_V1_SERIAL_NUMBER_SINCE_VERSION && output->serial[0] != '\0') {
if (version >= ZWLR_OUTPUT_HEAD_V1_SERIAL_NUMBER_SINCE_VERSION && output->serial != NULL) {
zwlr_output_head_v1_send_serial_number(head_resource, output->serial);
}