output: Add initialization state to wlr_output_init

This commit is contained in:
Alexander Orzechowski 2023-08-16 11:35:28 -04:00
parent 8f67446cc7
commit 6cda3e251c
6 changed files with 12 additions and 6 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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.
*

View file

@ -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) {