aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-12-19 18:25:46 -0500
committerTony Crisci <tony@dubstepdish.com>2017-12-19 18:25:46 -0500
commita937016e38efe3d7ad71540755833242059e6902 (patch)
tree3ac662b470154f1b496e22f456fc5772b6457411
parent4e804ef40f46136d4fe84603a8236adc172260f8 (diff)
remove session from multibackend
-rw-r--r--backend/backend.c2
-rw-r--r--backend/drm/backend.c5
-rw-r--r--backend/multi/backend.c22
-rw-r--r--include/backend/drm/drm.h2
-rw-r--r--include/backend/multi.h1
-rw-r--r--include/wlr/backend/multi.h4
6 files changed, 19 insertions, 17 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 58181947..7dfd6676 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -93,7 +93,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
return NULL;
}
- backend = wlr_multi_backend_create(display, session);
+ backend = wlr_multi_backend_create(display);
if (!backend) {
goto error_session;
}
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 6be5e5d5..112b2b61 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -174,3 +174,8 @@ error_fd:
free(drm);
return NULL;
}
+
+struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend) {
+ struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
+ return drm->session;
+}
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 3815a0bc..df7c8c6d 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -5,6 +5,7 @@
#include <wlr/backend/session.h>
#include <wlr/util/log.h>
#include "backend/multi.h"
+#include "backend/drm/drm.h"
struct subbackend_state {
struct wlr_backend *backend;
@@ -57,14 +58,7 @@ struct wlr_backend_impl backend_impl = {
.get_egl = multi_backend_get_egl,
};
-static void handle_display_destroy(struct wl_listener *listener, void *data) {
- struct wlr_multi_backend *backend =
- wl_container_of(listener, backend, display_destroy);
- multi_backend_destroy(&backend->backend);
-}
-
-struct wlr_backend *wlr_multi_backend_create(struct wl_display *display,
- struct wlr_session *session) {
+struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
struct wlr_multi_backend *backend =
calloc(1, sizeof(struct wlr_multi_backend));
if (!backend) {
@@ -72,13 +66,9 @@ struct wlr_backend *wlr_multi_backend_create(struct wl_display *display,
return NULL;
}
- backend->session = session;
wl_list_init(&backend->backends);
wlr_backend_init(&backend->backend, &backend_impl);
- session->display_destroy.notify = handle_display_destroy;
- wl_display_add_destroy_listener(display, &session->display_destroy);
-
return &backend->backend;
}
@@ -140,5 +130,11 @@ struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) {
assert(wlr_backend_is_multi(_backend));
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend;
- return backend->session;
+ struct subbackend_state *sub;
+ wl_list_for_each(sub, &backend->backends, link) {
+ if (wlr_backend_is_drm(sub->backend)) {
+ return wlr_drm_backend_get_session(sub->backend);
+ }
+ }
+ return NULL;
}
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 278c387c..72671f45 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -143,4 +143,6 @@ int wlr_drm_event(int fd, uint32_t mask, void *data);
void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn);
+struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
+
#endif
diff --git a/include/backend/multi.h b/include/backend/multi.h
index 2798048d..f0e50fc0 100644
--- a/include/backend/multi.h
+++ b/include/backend/multi.h
@@ -9,7 +9,6 @@
struct wlr_multi_backend {
struct wlr_backend backend;
- struct wlr_session *session;
struct wl_list backends;
struct wl_listener display_destroy;
diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h
index e56b07b1..fc53f369 100644
--- a/include/wlr/backend/multi.h
+++ b/include/wlr/backend/multi.h
@@ -4,8 +4,8 @@
#include <wlr/backend.h>
#include <wlr/backend/session.h>
-struct wlr_backend *wlr_multi_backend_create(struct wl_display *display,
- struct wlr_session *session);
+struct wlr_backend *wlr_multi_backend_create(struct wl_display *display);
+
void wlr_multi_backend_add(struct wlr_backend *multi,
struct wlr_backend *backend);