mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
Fix furhter wayland backend issues
This commit is contained in:
parent
8fbf1ca3ff
commit
10526de444
@ -8,6 +8,7 @@
|
||||
#include <wlr/backend/interface.h>
|
||||
#include <wlr/backend/drm.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/backend/wayland.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include "backend/libinput.h"
|
||||
#include "backend/udev.h"
|
||||
@ -42,6 +43,9 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||
struct wlr_session *session) {
|
||||
// TODO: Choose the most appropriate backend for the situation
|
||||
// Attempt DRM+libinput
|
||||
if(getenv("WAYLAND_DISPLAY") || getenv("_WAYLAND_DISPLAY")) {
|
||||
return wlr_wl_backend_create(display, 1);
|
||||
}
|
||||
struct wlr_udev *udev;
|
||||
if (!(udev = wlr_udev_create(display))) {
|
||||
wlr_log(L_ERROR, "Failed to start udev");
|
||||
|
@ -13,14 +13,16 @@
|
||||
* the specified display.
|
||||
*/
|
||||
static bool wlr_wl_backend_init(struct wlr_backend_state* state) {
|
||||
wlr_log(L_INFO, "Initializating wayland backend");
|
||||
|
||||
state->remote_display = wl_display_connect(getenv("_WAYLAND_DISPLAY"));
|
||||
if (!state->remote_display) {
|
||||
wlr_log(L_ERROR, "Could not connect to remote display");
|
||||
wlr_log_errno(L_ERROR, "Could not connect to remote display");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(state->registry = wl_display_get_registry(state->remote_display))) {
|
||||
wlr_log(L_ERROR, "Could not obtain reference to remote registry");
|
||||
wlr_log_errno(L_ERROR, "Could not obtain reference to remote registry");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -57,7 +59,7 @@ static struct wlr_backend_impl backend_impl = {
|
||||
|
||||
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
||||
size_t outputs) {
|
||||
wlr_log(L_INFO, "Initalizing wayland backend");
|
||||
wlr_log(L_INFO, "Creating wayland backend");
|
||||
|
||||
struct wlr_backend_state *state = calloc(1, sizeof(struct wlr_backend_state));
|
||||
if (!state) {
|
||||
@ -76,6 +78,11 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(state->devices = list_create())) {
|
||||
wlr_log(L_ERROR, "Could not allocate devices list");
|
||||
goto error;
|
||||
}
|
||||
|
||||
state->local_display = display;
|
||||
state->backend = backend;
|
||||
|
||||
|
@ -44,23 +44,24 @@ static struct wlr_output_impl output_impl = {
|
||||
};
|
||||
|
||||
static void registry_wl_output(struct wlr_backend_state *state,
|
||||
struct wl_output *wl_output, struct wl_registry *registry, uint32_t version) {
|
||||
struct wlr_output_state *output;
|
||||
if (!(output = calloc(sizeof(struct wlr_output_state), 1))) {
|
||||
struct wl_output *wl_output, struct wl_registry *registry,
|
||||
uint32_t version) {
|
||||
struct wlr_output_state *ostate;
|
||||
if (!(ostate = calloc(sizeof(struct wlr_output_state), 1))) {
|
||||
wlr_log(L_ERROR, "Failed to allocate wlr_wl_output");
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_output *wlr_output = wlr_output_create(&output_impl, output);
|
||||
struct wlr_output *wlr_output = wlr_output_create(&output_impl, ostate);
|
||||
if (!wlr_output) {
|
||||
free(state);
|
||||
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
|
||||
free(ostate);
|
||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
||||
return;
|
||||
}
|
||||
|
||||
output->output = wl_output;
|
||||
list_add(state->outputs, output);
|
||||
wl_output_add_listener(wl_output, &output_listener, output);
|
||||
ostate->output = wl_output;
|
||||
list_add(state->outputs, wlr_output);
|
||||
wl_output_add_listener(wl_output, &output_listener, wlr_output);
|
||||
wl_signal_emit(&state->backend->events.output_add, wlr_output);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user