diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-04-25 15:06:58 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-04-25 15:06:58 -0400 |
commit | de01e654cef2c72dce3adb580e20fe2cbc8aeb16 (patch) | |
tree | 11dbed7b9a15b1f0bb43320243c74e780e791c99 /example | |
parent | 52e6ed54cbaf05cd1829099e04427d1706ca0da4 (diff) |
Flesh out wayland backend somewhat, add example
Diffstat (limited to 'example')
-rw-r--r-- | example/CMakeLists.txt | 7 | ||||
-rw-r--r-- | example/main.c | 19 |
2 files changed, 26 insertions, 0 deletions
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt new file mode 100644 index 00000000..73768393 --- /dev/null +++ b/example/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(example + main.c +) + +target_link_libraries(example + wlr-backend +) diff --git a/example/main.c b/example/main.c new file mode 100644 index 00000000..4240b9e3 --- /dev/null +++ b/example/main.c @@ -0,0 +1,19 @@ +#define _POSIX_C_SOURCE 200112L +#include <stdlib.h> +#include <wlr/backend.h> +#include <wlr/backend/wayland.h> +#include <wayland-server.h> + +int main(int argc, char **argv) { + // TODO: Move this stuff to a wlr backend selector function + char *_wl_display = getenv("WAYLAND_DISPLAY"); + if (_wl_display) { + unsetenv("WAYLAND_DISPLAY"); + setenv("_WAYLAND_DISPLAY", _wl_display, 1); + } + struct wl_display *wl_display = wl_display_create(); + struct wlr_wl_backend *backend = wlr_wl_backend_init(wl_display, 1); + wlr_wl_backend_free(backend); + wl_display_destroy(wl_display); + return 0; +} |