mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-01 16:55:59 +01:00
only add first backend to multi autocreate
This commit is contained in:
parent
9871cde604
commit
4cec7f54e2
1 changed files with 15 additions and 5 deletions
|
@ -33,6 +33,10 @@ bool wlr_backend_start(struct wlr_backend *backend) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_backend_destroy(struct wlr_backend *backend) {
|
void wlr_backend_destroy(struct wlr_backend *backend) {
|
||||||
|
if (!backend) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wl_signal_emit(&backend->events.destroy, backend);
|
wl_signal_emit(&backend->events.destroy, backend);
|
||||||
if (backend->impl && backend->impl->destroy) {
|
if (backend->impl && backend->impl->destroy) {
|
||||||
backend->impl->destroy(backend);
|
backend->impl->destroy(backend);
|
||||||
|
@ -82,6 +86,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
||||||
struct wlr_backend *wl_backend = attempt_wl_backend(display);
|
struct wlr_backend *wl_backend = attempt_wl_backend(display);
|
||||||
if (wl_backend) {
|
if (wl_backend) {
|
||||||
wlr_multi_backend_add(backend, wl_backend);
|
wlr_multi_backend_add(backend, wl_backend);
|
||||||
|
return backend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,18 +95,25 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
||||||
struct wlr_backend *x11_backend =
|
struct wlr_backend *x11_backend =
|
||||||
wlr_x11_backend_create(display, x11_display);
|
wlr_x11_backend_create(display, x11_display);
|
||||||
wlr_multi_backend_add(backend, x11_backend);
|
wlr_multi_backend_add(backend, x11_backend);
|
||||||
|
return backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt DRM+libinput
|
// Attempt DRM+libinput
|
||||||
struct wlr_session *session = wlr_session_create(display);
|
struct wlr_session *session = wlr_session_create(display);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log(L_ERROR, "Failed to start a DRM session");
|
wlr_log(L_ERROR, "Failed to start a DRM session");
|
||||||
goto out;
|
wlr_backend_destroy(backend);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
|
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
|
||||||
if (libinput) {
|
if (libinput) {
|
||||||
wlr_multi_backend_add(backend, libinput);
|
wlr_multi_backend_add(backend, libinput);
|
||||||
|
} else {
|
||||||
|
wlr_log(L_ERROR, "Failed to start libinput backend");
|
||||||
|
wlr_backend_destroy(backend);
|
||||||
|
wlr_session_destroy(session);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gpus[8];
|
int gpus[8];
|
||||||
|
@ -126,10 +138,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
||||||
|
|
||||||
if (!primary_drm) {
|
if (!primary_drm) {
|
||||||
wlr_log(L_ERROR, "Failed to open any DRM device");
|
wlr_log(L_ERROR, "Failed to open any DRM device");
|
||||||
}
|
wlr_backend_destroy(libinput);
|
||||||
|
wlr_session_destroy(session);
|
||||||
out:
|
|
||||||
if (wlr_multi_is_empty(backend)) {
|
|
||||||
wlr_backend_destroy(backend);
|
wlr_backend_destroy(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue