diff options
author | Simon Ser <contact@emersion.fr> | 2021-12-09 15:43:19 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-12-09 15:46:46 +0100 |
commit | 36a2b19485ad299ee0039eb97c0f688d68205539 (patch) | |
tree | 73e9cd16a35925282fc41e1221c802d5175600be /backend | |
parent | 1fbd13ec799c472558aef37436367f0e947f7d89 (diff) |
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.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 3 | ||||
-rw-r--r-- | backend/headless/output.c | 6 | ||||
-rw-r--r-- | backend/wayland/output.c | 6 | ||||
-rw-r--r-- | backend/x11/output.c | 6 |
4 files changed, 13 insertions, 8 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index d7c53231..1a46b495 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1299,8 +1299,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm, wlr_output_init(&wlr_conn->output, &drm->backend, &output_impl, drm->display); - memcpy(wlr_conn->output.name, wlr_conn->name, - sizeof(wlr_conn->output.name)); + wlr_output_set_name(&wlr_conn->output, wlr_conn->name); wlr_conn->output.phys_width = drm_conn->mmWidth; wlr_conn->output.phys_height = drm_conn->mmHeight; diff --git a/backend/headless/output.c b/backend/headless/output.c index 50d914e4..fbec8110 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -116,8 +116,10 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend, output_set_custom_mode(output, width, height, 0); strncpy(wlr_output->make, "headless", sizeof(wlr_output->make)); strncpy(wlr_output->model, "headless", sizeof(wlr_output->model)); - snprintf(wlr_output->name, sizeof(wlr_output->name), "HEADLESS-%zd", - ++backend->last_output_num); + + char name[64]; + snprintf(name, sizeof(name), "HEADLESS-%zd", ++backend->last_output_num); + wlr_output_set_name(wlr_output, name); char description[128]; snprintf(description, sizeof(description), diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 3fa86a3c..27195592 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -520,8 +520,10 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { wlr_output_update_custom_mode(wlr_output, 1280, 720, 0); strncpy(wlr_output->make, "wayland", sizeof(wlr_output->make)); strncpy(wlr_output->model, "wayland", sizeof(wlr_output->model)); - snprintf(wlr_output->name, sizeof(wlr_output->name), "WL-%zd", - ++backend->last_output_num); + + char name[64]; + snprintf(name, sizeof(name), "WL-%zd", ++backend->last_output_num); + wlr_output_set_name(wlr_output, name); char description[128]; snprintf(description, sizeof(description), diff --git a/backend/x11/output.c b/backend/x11/output.c index 9081769e..25194e70 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -512,8 +512,10 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { wlr_output_update_custom_mode(wlr_output, 1024, 768, 0); - snprintf(wlr_output->name, sizeof(wlr_output->name), "X11-%zd", - ++x11->last_output_num); + char name[64]; + snprintf(name, sizeof(name), "X11-%zd", ++x11->last_output_num); + wlr_output_set_name(wlr_output, name); + parse_xcb_setup(wlr_output, x11->xcb); char description[128]; |