Add X11 backend skeleton

This commit is contained in:
Scott Anderson 2017-09-22 14:58:41 +12:00
parent 6479fb27be
commit a598e6d026
5 changed files with 54 additions and 3 deletions

View file

@ -10,6 +10,7 @@
#include <wlr/backend/drm.h>
#include <wlr/backend/libinput.h>
#include <wlr/backend/wayland.h>
#include <wlr/backend/x11.h>
#include <wlr/backend/multi.h>
#include <wlr/util/log.h>
@ -77,9 +78,9 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
}
}
if (getenv("DISPLAY")) {
wlr_log(L_ERROR, "X11 backend is not implemented"); // TODO
return NULL;
const char *x11_display = getenv("DISPLAY");
if (x11_display) {
return wlr_x11_backend_create(x11_display);
}
// Attempt DRM+libinput

View file

@ -22,6 +22,7 @@ backend_files = files(
'wayland/registry.c',
'wayland/wl_seat.c',
'wayland/os-compatibility.c',
'x11/backend.c',
)
if systemd.found()

30
backend/x11/backend.c Normal file
View file

@ -0,0 +1,30 @@
#include <stdbool.h>
#include <wlr/backend/interface.h>
#include <wlr/backend/x11.h>
#include <wlr/egl.h>
#include "backend/x11.h"
struct wlr_backend *wlr_x11_backend_create(const char *display) {
return NULL;
}
static bool wlr_x11_backend_start(struct wlr_backend *backend) {
return false;
}
static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
}
struct wlr_egl *wlr_x11_backend_get_egl(struct wlr_backend *backend) {
return NULL;
}
static struct wlr_backend_impl backend_impl = {
.start = wlr_x11_backend_start,
.destroy = wlr_x11_backend_destroy,
.get_egl = wlr_x11_backend_get_egl,
};
bool wlr_backend_is_x11(struct wlr_backend *backend) {
return backend->impl == &backend_impl;
}

8
include/backend/x11.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef WLR_X11_H
#define WLR_X11_H
struct wlr_x11_backend {
struct wlr_backend backend;
};
#endif

11
include/wlr/backend/x11.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef WLR_BACKEND_X11_H
#define WLR_BACKEND_X11_H
#include <wlr/backend.h>
#include <stdbool.h>
struct wlr_backend *wlr_x11_backend_create(const char *display);
bool wlr_backend_is_x11(struct wlr_backend *backend);
#endif