From 4da4a15d6bfa8d4b92d1ac4605ea78893da3fab0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 26 Dec 2019 16:09:05 +0100 Subject: 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 --- backend/drm/drm.c | 6 ++++++ backend/headless/output.c | 5 +++++ backend/rdp/output.c | 5 +++++ backend/wayland/output.c | 5 +++++ backend/x11/output.c | 5 +++++ 5 files changed, 26 insertions(+) (limited to 'backend') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 5e7369fd..a4f22590 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -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) { diff --git a/backend/headless/output.c b/backend/headless/output.c index 992a4883..add00f76 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -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; diff --git a/backend/rdp/output.c b/backend/rdp/output.c index 45eba3aa..302a99de 100644 --- a/backend/rdp/output.c +++ b/backend/rdp/output.c @@ -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; diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 5d3a5ff5..adff43af 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -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); diff --git a/backend/x11/output.c b/backend/x11/output.c index 1307f785..b6d00852 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -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 -- cgit v1.2.3