output: add description

wlr_output.description is a string containing a human-readable string
identifying the output. Compositors can customise it via
wlr_output_set_description, for instance to make the name more
user-friendly.

References: https://github.com/swaywm/wlroots/issues/1623
This commit is contained in:
Simon Ser 2019-12-26 16:09:05 +01:00 committed by Brian Ashworth
parent a420d2c41e
commit 4da4a15d6b
7 changed files with 48 additions and 0 deletions

View file

@ -1348,6 +1348,12 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
parse_edid(&wlr_conn->output, edid_len, edid);
free(edid);
struct wlr_output *output = &wlr_conn->output;
char description[128];
snprintf(description, sizeof(description), "%s %s %s (%s)",
output->make, output->model, output->serial, output->name);
wlr_output_set_description(output, description);
wlr_log(WLR_INFO, "Detected modes:");
for (int i = 0; i < drm_conn->count_modes; ++i) {

View file

@ -121,6 +121,11 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
snprintf(wlr_output->name, sizeof(wlr_output->name), "HEADLESS-%zd",
++backend->last_output_num);
char description[128];
snprintf(description, sizeof(description),
"Headless output %zd", backend->last_output_num);
wlr_output_set_description(wlr_output, description);
if (!wlr_egl_make_current(&output->backend->egl, output->egl_surface,
NULL)) {
goto error;

View file

@ -278,6 +278,11 @@ struct wlr_rdp_output *wlr_rdp_output_create(struct wlr_rdp_backend *backend,
snprintf(wlr_output->name, sizeof(wlr_output->name), "RDP-%d",
wl_list_length(&backend->clients));
char description[128];
snprintf(description, sizeof(description),
"RDP output %d", wl_list_length(&backend->clients));
wlr_output_set_description(wlr_output, description);
if (!wlr_egl_make_current(&output->backend->egl, output->egl_surface,
NULL)) {
goto error;

View file

@ -458,6 +458,11 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) {
snprintf(wlr_output->name, sizeof(wlr_output->name), "WL-%zd",
++backend->last_output_num);
char description[128];
snprintf(description, sizeof(description),
"Wayland output %zd", backend->last_output_num);
wlr_output_set_description(wlr_output, description);
output->backend = backend;
wl_list_init(&output->presentation_feedbacks);

View file

@ -149,6 +149,11 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
++x11->last_output_num);
parse_xcb_setup(wlr_output, x11->xcb);
char description[128];
snprintf(description, sizeof(description),
"X11 output %zd", x11->last_output_num);
wlr_output_set_description(wlr_output, description);
uint32_t mask = XCB_CW_EVENT_MASK;
uint32_t values[] = {
XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY