output: introduce wlr_output_set_name

wlroots picks names for all outputs, but it might be desirable for
compositor to override it.

For instance, Sway will use a headless output as a fallback in
case no outputs are connected. Sway wants to clearly label the
fallback output as such and label "real" headless outputs starting
from HEADLESS-1.
This commit is contained in:
Simon Ser 2021-12-09 15:43:19 +01:00
parent 1fbd13ec79
commit 36a2b19485
6 changed files with 33 additions and 9 deletions

View file

@ -118,7 +118,7 @@ struct wlr_output {
struct wl_global *global;
struct wl_list resources;
char name[24];
char *name;
char *description; // may be NULL
char make[56];
char model[16];
@ -336,6 +336,17 @@ void wlr_output_set_render_format(struct wlr_output *output, uint32_t format);
void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_set_subpixel(struct wlr_output *output,
enum wl_output_subpixel subpixel);
/**
* Set the output name.
*
* Output names are subject to the following rules:
*
* - Each output name must be unique.
* - The name cannot change after the output has been advertised to clients.
*
* For more details, see the protocol documentation for wl_output.name.
*/
void wlr_output_set_name(struct wlr_output *output, const char *name);
void wlr_output_set_description(struct wlr_output *output, const char *desc);
/**
* Schedule a done event.