summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2023-04-16 18:29:00 +0200
committerPhilipp Zabel <philipp.zabel@gmail.com>2023-04-17 09:40:52 +0200
commit78818c6d2484bb18cd0e7660b311e5163d864db1 (patch)
treea7a69b73d2dd35140f3e59a219479d74a0bd5641
parent0a1d77a72876042db742b73dd34ff3ba6c6a5878 (diff)
downloadweston-78818c6d2484bb18cd0e7660b311e5163d864db1.tar.gz
backend-vnc: pass vnc_backend to vnc_head_create()
Pass the VNC backend to vnc_head_create(). That way the already known backend will not have to be found from the compositor. This is trivial now, but in the multi-backend case would entail iterating over all backends to find the correct one. Also remove the now unused to_vnc_backend() helper. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
-rw-r--r--libweston/backend-vnc/vnc.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/libweston/backend-vnc/vnc.c b/libweston/backend-vnc/vnc.c
index 9b22f59c..2d8042d6 100644
--- a/libweston/backend-vnc/vnc.c
+++ b/libweston/backend-vnc/vnc.c
@@ -101,12 +101,6 @@ struct vnc_head {
struct weston_head base;
};
-static inline struct vnc_backend *
-to_vnc_backend(struct weston_compositor *base)
-{
- return container_of(base->backend, struct vnc_backend, base);
-}
-
static void
vnc_output_destroy(struct weston_output *base);
@@ -841,9 +835,8 @@ vnc_destroy(struct weston_backend *base)
}
static void
-vnc_head_create(struct weston_compositor *compositor, const char *name)
+vnc_head_create(struct vnc_backend *backend, const char *name)
{
- struct vnc_backend *backend = to_vnc_backend(compositor);
struct vnc_head *head;
head = xzalloc(sizeof *head);
@@ -855,7 +848,7 @@ vnc_head_create(struct weston_compositor *compositor, const char *name)
head->base.backend = &backend->base;
weston_head_set_connection_status(&head->base, true);
- weston_compositor_add_head(compositor, &head->base);
+ weston_compositor_add_head(backend->compositor, &head->base);
}
static void
@@ -1107,7 +1100,7 @@ vnc_backend_create(struct weston_compositor *compositor,
NULL) < 0)
goto err_compositor;
- vnc_head_create(compositor, "vnc");
+ vnc_head_create(backend, "vnc");
compositor->capabilities |= WESTON_CAP_ARBITRARY_MODES;