From a598e6d026548ce7ab580504e05a71a5296b83f0 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 22 Sep 2017 14:58:41 +1200 Subject: [PATCH] Add X11 backend skeleton --- backend/backend.c | 7 ++++--- backend/meson.build | 1 + backend/x11/backend.c | 30 ++++++++++++++++++++++++++++++ include/backend/x11.h | 8 ++++++++ include/wlr/backend/x11.h | 11 +++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 backend/x11/backend.c create mode 100644 include/backend/x11.h create mode 100644 include/wlr/backend/x11.h diff --git a/backend/backend.c b/backend/backend.c index 88b9dfbc..21f342ad 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -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 diff --git a/backend/meson.build b/backend/meson.build index a3cb7b64..9e3b6fed 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -22,6 +22,7 @@ backend_files = files( 'wayland/registry.c', 'wayland/wl_seat.c', 'wayland/os-compatibility.c', + 'x11/backend.c', ) if systemd.found() diff --git a/backend/x11/backend.c b/backend/x11/backend.c new file mode 100644 index 00000000..be022a7a --- /dev/null +++ b/backend/x11/backend.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#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; +} diff --git a/include/backend/x11.h b/include/backend/x11.h new file mode 100644 index 00000000..2f319672 --- /dev/null +++ b/include/backend/x11.h @@ -0,0 +1,8 @@ +#ifndef WLR_X11_H +#define WLR_X11_H + +struct wlr_x11_backend { + struct wlr_backend backend; +}; + +#endif diff --git a/include/wlr/backend/x11.h b/include/wlr/backend/x11.h new file mode 100644 index 00000000..28d027c5 --- /dev/null +++ b/include/wlr/backend/x11.h @@ -0,0 +1,11 @@ +#ifndef WLR_BACKEND_X11_H +#define WLR_BACKEND_X11_H + +#include +#include + +struct wlr_backend *wlr_x11_backend_create(const char *display); + +bool wlr_backend_is_x11(struct wlr_backend *backend); + +#endif