aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/drm.c6
-rw-r--r--backend/headless/output.c5
-rw-r--r--backend/rdp/output.c5
-rw-r--r--backend/wayland/output.c5
-rw-r--r--backend/x11/output.c5
-rw-r--r--include/wlr/types/wlr_output.h3
-rw-r--r--types/wlr_output.c19
7 files changed, 48 insertions, 0 deletions
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
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index b8087ebd..183e5a29 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -90,6 +90,7 @@ struct wlr_output {
struct wl_list resources;
char name[24];
+ char *description; // may be NULL
char make[56];
char model[16];
char serial[16];
@@ -133,6 +134,7 @@ struct wlr_output {
struct wl_signal mode;
struct wl_signal scale;
struct wl_signal transform;
+ struct wl_signal description;
struct wl_signal destroy;
} events;
@@ -214,6 +216,7 @@ void wlr_output_set_transform(struct wlr_output *output,
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);
+void wlr_output_set_description(struct wlr_output *output, const char *desc);
/**
* Schedule a done event.
*
diff --git a/types/wlr_output.c b/types/wlr_output.c
index c9f14688..a7aad592 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -270,6 +270,22 @@ void wlr_output_set_subpixel(struct wlr_output *output,
wlr_output_schedule_done(output);
}
+void wlr_output_set_description(struct wlr_output *output, const char *desc) {
+ if (output->description != NULL && desc != NULL &&
+ strcmp(output->description, desc) == 0) {
+ return;
+ }
+
+ free(output->description);
+ if (desc != NULL) {
+ output->description = strdup(desc);
+ } else {
+ output->description = NULL;
+ }
+
+ wlr_signal_emit_safe(&output->events.description, output);
+}
+
static void schedule_done_handle_idle_timer(void *data) {
struct wlr_output *output = data;
output->idle_done = NULL;
@@ -323,6 +339,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
wl_signal_init(&output->events.mode);
wl_signal_init(&output->events.scale);
wl_signal_init(&output->events.transform);
+ wl_signal_init(&output->events.description);
wl_signal_init(&output->events.destroy);
pixman_region32_init(&output->damage);
pixman_region32_init(&output->pending.damage);
@@ -365,6 +382,8 @@ void wlr_output_destroy(struct wlr_output *output) {
wl_event_source_remove(output->idle_done);
}
+ free(output->description);
+
pixman_region32_fini(&output->pending.damage);
pixman_region32_fini(&output->damage);