aboutsummaryrefslogtreecommitdiff
path: root/backend/backend.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-12-19 19:07:33 -0500
committerTony Crisci <tony@dubstepdish.com>2017-12-19 19:07:33 -0500
commitca6a0ef1bbbd611c9ebf0ace08b8fc6af3883d09 (patch)
treee3523d4df150c6dd1f66bcb91432282562d57293 /backend/backend.c
parent58e69c9ce177f3de4790bddd161e9d74dd2e512c (diff)
always return multibakend from autocreate
Diffstat (limited to 'backend/backend.c')
-rw-r--r--backend/backend.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 7dfd6676..2adc3171 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -72,30 +72,31 @@ static struct wlr_backend *attempt_wl_backend(struct wl_display *display) {
}
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
- struct wlr_backend *backend;
+ struct wlr_backend *backend = wlr_multi_backend_create(display);
+ if (!backend) {
+ wlr_log(L_ERROR, "could not allocate multibackend");
+ return NULL;
+ }
+
if (getenv("WAYLAND_DISPLAY") || getenv("_WAYLAND_DISPLAY")) {
- backend = attempt_wl_backend(display);
- if (backend) {
- return backend;
+ struct wlr_backend *wl_backend = attempt_wl_backend(display);
+ if (wl_backend) {
+ wlr_multi_backend_add(backend, wl_backend);
}
}
const char *x11_display = getenv("DISPLAY");
if (x11_display) {
- return wlr_x11_backend_create(display, x11_display);
+ struct wlr_backend *x11_backend =
+ wlr_x11_backend_create(display, x11_display);
+ wlr_multi_backend_add(backend, x11_backend);
}
// Attempt DRM+libinput
-
struct wlr_session *session = wlr_session_create(display);
if (!session) {
wlr_log(L_ERROR, "Failed to start a DRM session");
- return NULL;
- }
-
- backend = wlr_multi_backend_create(display);
- if (!backend) {
- goto error_session;
+ return backend;
}
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
@@ -134,9 +135,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
error_multi:
wlr_backend_destroy(backend);
-error_session:
wlr_session_destroy(session);
- return NULL;
+ return backend;
}
uint32_t usec_to_msec(uint64_t usec) {