aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/backend.c3
-rw-r--r--backend/drm/drm.c3
-rw-r--r--backend/headless/backend.c3
-rw-r--r--backend/headless/output.c3
-rw-r--r--backend/libinput/backend.c3
-rw-r--r--backend/multi/backend.c3
-rw-r--r--backend/wayland/backend.c7
-rw-r--r--backend/wayland/output.c3
-rw-r--r--backend/x11/backend.c3
-rw-r--r--backend/x11/output.c3
10 files changed, 22 insertions, 12 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index b3af3005..54852185 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -16,7 +16,8 @@
struct wlr_drm_backend *get_drm_backend_from_backend(
struct wlr_backend *wlr_backend) {
assert(wlr_backend_is_drm(wlr_backend));
- return (struct wlr_drm_backend *)wlr_backend;
+ struct wlr_drm_backend *backend = wl_container_of(wlr_backend, backend, backend);
+ return backend;
}
static bool backend_start(struct wlr_backend *backend) {
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 5f71f923..fdbab3bf 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -331,7 +331,8 @@ void finish_drm_resources(struct wlr_drm_backend *drm) {
static struct wlr_drm_connector *get_drm_connector_from_output(
struct wlr_output *wlr_output) {
assert(wlr_output_is_drm(wlr_output));
- return (struct wlr_drm_connector *)wlr_output;
+ struct wlr_drm_connector *conn = wl_container_of(wlr_output, conn, output);
+ return conn;
}
static void layer_handle_addon_destroy(struct wlr_addon *addon) {
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index df14d6af..f0cde0c7 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -7,7 +7,8 @@
struct wlr_headless_backend *headless_backend_from_backend(
struct wlr_backend *wlr_backend) {
assert(wlr_backend_is_headless(wlr_backend));
- return (struct wlr_headless_backend *)wlr_backend;
+ struct wlr_headless_backend *backend = wl_container_of(wlr_backend, backend, backend);
+ return backend;
}
static bool backend_start(struct wlr_backend *wlr_backend) {
diff --git a/backend/headless/output.c b/backend/headless/output.c
index db7b707f..9cac54d1 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -17,7 +17,8 @@ static size_t last_output_num = 0;
static struct wlr_headless_output *headless_output_from_output(
struct wlr_output *wlr_output) {
assert(wlr_output_is_headless(wlr_output));
- return (struct wlr_headless_output *)wlr_output;
+ struct wlr_headless_output *output = wl_container_of(wlr_output, output, wlr_output);
+ return output;
}
static bool output_set_custom_mode(struct wlr_headless_output *output,
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index 688fae5d..e95127bd 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -11,7 +11,8 @@
static struct wlr_libinput_backend *get_libinput_backend_from_backend(
struct wlr_backend *wlr_backend) {
assert(wlr_backend_is_libinput(wlr_backend));
- return (struct wlr_libinput_backend *)wlr_backend;
+ struct wlr_libinput_backend *backend = wl_container_of(wlr_backend, backend, backend);
+ return backend;
}
static int libinput_open_restricted(const char *path,
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 49792ff9..1ee21c14 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -21,7 +21,8 @@ struct subbackend_state {
static struct wlr_multi_backend *multi_backend_from_backend(
struct wlr_backend *wlr_backend) {
assert(wlr_backend_is_multi(wlr_backend));
- return (struct wlr_multi_backend *)wlr_backend;
+ struct wlr_multi_backend *backend = wl_container_of(wlr_backend, backend, backend);
+ return backend;
}
static bool multi_backend_start(struct wlr_backend *wlr_backend) {
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index ba13aa30..82285be9 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -46,9 +46,10 @@ struct wlr_wl_linux_dmabuf_v1_table_entry {
uint64_t modifier;
};
-struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend) {
- assert(wlr_backend_is_wl(backend));
- return (struct wlr_wl_backend *)backend;
+struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *wlr_backend) {
+ assert(wlr_backend_is_wl(wlr_backend));
+ struct wlr_wl_backend *backend = wl_container_of(wlr_backend, backend, backend);
+ return backend;
}
static int dispatch_events(int fd, uint32_t mask, void *data) {
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index bf668cc4..9371ca72 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -39,7 +39,8 @@ static size_t last_output_num = 0;
static struct wlr_wl_output *get_wl_output_from_output(
struct wlr_output *wlr_output) {
assert(wlr_output_is_wl(wlr_output));
- return (struct wlr_wl_output *)wlr_output;
+ struct wlr_wl_output *output = wl_container_of(wlr_output, output, wlr_output);
+ return output;
}
static void surface_frame_callback(void *data, struct wl_callback *cb,
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 51cb5ca4..fcaab618 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -154,7 +154,8 @@ static int x11_event(int fd, uint32_t mask, void *data) {
struct wlr_x11_backend *get_x11_backend_from_backend(
struct wlr_backend *wlr_backend) {
assert(wlr_backend_is_x11(wlr_backend));
- return (struct wlr_x11_backend *)wlr_backend;
+ struct wlr_x11_backend *backend = wl_container_of(wlr_backend, backend, backend);
+ return backend;
}
static bool backend_start(struct wlr_backend *backend) {
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 175204fa..36ce0c4f 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -54,7 +54,8 @@ static void parse_xcb_setup(struct wlr_output *output,
static struct wlr_x11_output *get_x11_output_from_output(
struct wlr_output *wlr_output) {
assert(wlr_output_is_x11(wlr_output));
- return (struct wlr_x11_output *)wlr_output;
+ struct wlr_x11_output *output = wl_container_of(wlr_output, output, wlr_output);
+ return output;
}
static bool output_set_custom_mode(struct wlr_output *wlr_output,