From 6cda3e251c8f78a376b3a239c2c4fd7fae1a3f3e Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Wed, 16 Aug 2023 11:35:28 -0400 Subject: [PATCH] output: Add initialization state to wlr_output_init --- backend/drm/drm.c | 2 +- backend/headless/output.c | 2 +- backend/wayland/output.c | 2 +- backend/x11/output.c | 2 +- include/wlr/interfaces/wlr_output.h | 3 ++- types/output/output.c | 7 ++++++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 5e3345450..bf6d0bd51 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1373,7 +1373,7 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn, wlr_conn->crtc ? (int)wlr_conn->crtc->id : -1); wlr_output_init(&wlr_conn->output, &drm->backend, &output_impl, - drm->display); + drm->display, NULL); wlr_output_set_name(&wlr_conn->output, wlr_conn->name); diff --git a/backend/headless/output.c b/backend/headless/output.c index 9cac54d12..12bededc4 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -121,7 +121,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend, } output->backend = backend; wlr_output_init(&output->wlr_output, &backend->backend, &output_impl, - backend->display); + backend->display, NULL); struct wlr_output *wlr_output = &output->wlr_output; output_set_custom_mode(output, width, height, 0); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 24b3ff032..6d2212851 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -765,7 +765,7 @@ static struct wlr_wl_output *output_create(struct wlr_wl_backend *backend, return NULL; } wlr_output_init(&output->wlr_output, &backend->backend, &output_impl, - backend->local_display); + backend->local_display, NULL); struct wlr_output *wlr_output = &output->wlr_output; wlr_output_update_custom_mode(wlr_output, 1280, 720, 0); diff --git a/backend/x11/output.c b/backend/x11/output.c index 2d433f818..81cb5961a 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -539,7 +539,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { pixman_region32_init(&output->exposed); struct wlr_output *wlr_output = &output->wlr_output; - wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->wl_display); + wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->wl_display, NULL); wlr_output_update_custom_mode(wlr_output, 1024, 768, 0); diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 6c0bbd6c7..423743283 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -101,7 +101,8 @@ struct wlr_output_impl { * Initialize a new output. */ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, - const struct wlr_output_impl *impl, struct wl_display *display); + const struct wlr_output_impl *impl, struct wl_display *display, + const struct wlr_output_state *state); /** * Update the current output mode. * diff --git a/types/output/output.c b/types/output/output.c index b08ca51ad..b92d482b3 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -414,7 +414,8 @@ static void output_apply_state(struct wlr_output *output, } void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, - const struct wlr_output_impl *impl, struct wl_display *display) { + const struct wlr_output_impl *impl, struct wl_display *display, + const struct wlr_output_state *state) { assert(impl->commit); if (impl->set_cursor || impl->move_cursor) { assert(impl->set_cursor && impl->move_cursor); @@ -455,6 +456,10 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, output->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &output->display_destroy); + + if (state) { + output_apply_state(output, state); + } } void wlr_output_destroy(struct wlr_output *output) {