commit 502f272bd529815a19d839c138e02854657c37c0
parent f73931200d2bb735b4470f60d9e21eaf6fa8d6ac
Author: sewn <sewn@disroot.org>
Date: Sat, 14 Mar 2026 11:46:47 +0300
Implement wl_output version 4
Diffstat:
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/libswc/output.c b/libswc/output.c
@@ -20,7 +20,7 @@ bind_output(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
struct output *output = data;
struct screen *screen = output->screen;
- struct mode *mode;
+ struct mode *mode = &screen->planes.primary.mode;
struct wl_resource *resource;
uint32_t flags;
@@ -54,6 +54,10 @@ bind_output(struct wl_client *client, void *data, uint32_t version, uint32_t id)
mode->refresh);
}
+ if (version >= 4) {
+ wl_output_send_name(resource, output->name);
+ }
+
if (version >= 2) {
wl_output_send_done(resource);
}
@@ -64,6 +68,7 @@ output_new(drmModeConnectorPtr connector)
{
struct output *output;
struct mode *modes;
+ const char *name;
uint32_t i;
if (!(output = malloc(sizeof(*output)))) {
@@ -71,7 +76,7 @@ output_new(drmModeConnectorPtr connector)
goto error0;
}
- output->global = wl_global_create(swc.display, &wl_output_interface, 3,
+ output->global = wl_global_create(swc.display, &wl_output_interface, 4,
output, &bind_output);
if (!output->global) {
@@ -112,6 +117,10 @@ output_new(drmModeConnectorPtr connector)
output->preferred_mode = &modes[0];
}
+ if (!(name = drmModeGetConnectorTypeName(connector->connector_type)))
+ name = "UNKNOWN";
+ snprintf(output->name, sizeof(output->name), "%s-%d", name, connector->connector_type_id);
+
return output;
error2:
diff --git a/libswc/output.h b/libswc/output.h
@@ -11,6 +11,7 @@ struct wl_display;
struct output {
struct screen *screen;
+ char name[24];
/* The physical dimensions (in mm) of this output */
uint32_t physical_width, physical_height;