From 822a9f65a4f965a7561de287013c2a5c159453ab Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sat, 21 Oct 2017 17:37:25 +1300 Subject: [PATCH] Add pointer to backend inside wlr_output --- backend/drm/drm.c | 2 +- backend/wayland/output.c | 2 +- backend/x11/backend.c | 2 +- include/wlr/interfaces/wlr_output.h | 6 ++++-- include/wlr/types/wlr_output.h | 6 ++++-- types/wlr_output.c | 3 ++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0e898d3f..b3057166 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -707,7 +707,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { drmModeFreeConnector(drm_conn); continue; } - wlr_output_init(&wlr_conn->output, &output_impl); + wlr_output_init(&wlr_conn->output, &drm->backend, &output_impl); struct wl_event_loop *ev = wl_display_get_event_loop(drm->display); wlr_conn->retry_pageflip = wl_event_loop_add_timer(ev, retry_pageflip, diff --git a/backend/wayland/output.c b/backend/wayland/output.c index e1138ee1..0216823e 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -241,7 +241,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) { wlr_log(L_ERROR, "Failed to allocate wlr_wl_backend_output"); return NULL; } - wlr_output_init(&output->wlr_output, &output_impl); + wlr_output_init(&output->wlr_output, &backend->backend, &output_impl); struct wlr_output *wlr_output = &output->wlr_output; wlr_output->width = 640; diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 4ecca325..d30ec376 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -264,7 +264,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { output->x11 = x11; - wlr_output_init(&output->wlr_output, &output_impl); + wlr_output_init(&output->wlr_output, &x11->backend, &output_impl); snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1"); output->win = xcb_generate_id(x11->xcb_conn); diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index b7927569..17dd5538 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -1,8 +1,9 @@ #ifndef WLR_INTERFACES_WLR_OUTPUT_H #define WLR_INTERFACES_WLR_OUTPUT_H -#include #include +#include +#include struct wlr_output_impl { void (*enable)(struct wlr_output *output, bool enable); @@ -21,7 +22,8 @@ struct wlr_output_impl { uint16_t (*get_gamma_size)(struct wlr_output *output); }; -void wlr_output_init(struct wlr_output *output, const struct wlr_output_impl *impl); +void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, + const struct wlr_output_impl *impl); void wlr_output_free(struct wlr_output *output); void wlr_output_update_matrix(struct wlr_output *output); struct wl_global *wlr_output_create_global( diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 312b51f8..a2d595ea 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -1,9 +1,10 @@ #ifndef WLR_TYPES_WLR_OUTPUT_H #define WLR_TYPES_WLR_OUTPUT_H -#include -#include #include +#include +#include +#include struct wlr_output_mode { uint32_t flags; // enum wl_output_mode @@ -15,6 +16,7 @@ struct wlr_output_impl; struct wlr_output { const struct wlr_output_impl *impl; + struct wlr_backend *backend; struct wl_global *wl_global; struct wl_list wl_resources; diff --git a/types/wlr_output.c b/types/wlr_output.c index 5e10509e..c89c5c45 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -307,8 +307,9 @@ bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) { return output->impl->move_cursor(output, x, y); } -void wlr_output_init(struct wlr_output *output, +void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, const struct wlr_output_impl *impl) { + output->backend = backend; output->impl = impl; output->modes = list_create(); output->transform = WL_OUTPUT_TRANSFORM_NORMAL;