From 8ce9237c928a7dc6afb889291237465daf4d6b43 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 21 Jun 2017 14:33:39 -0400 Subject: Create WAYLAND_DISPLAY socket --- example/shared.c | 5 ++++- example/shared.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'example') diff --git a/example/shared.c b/example/shared.c index d9a6c1fd..b9689f1c 100644 --- a/example/shared.c +++ b/example/shared.c @@ -1,4 +1,4 @@ -#define _POSIX_C_SOURCE 199309L +#define _POSIX_C_SOURCE 200112L #include #include #include @@ -460,6 +460,9 @@ void compositor_init(struct compositor_state *state) { clock_gettime(CLOCK_MONOTONIC, &state->last_frame); + const char *socket = wl_display_add_socket_auto(state->display); + wlr_log(L_INFO, "Running compositor on wayland display '%s'", socket); + setenv("_WAYLAND_DISPLAY", socket, true); if (!wlr_backend_init(state->backend)) { wlr_log(L_ERROR, "Failed to initialize backend"); exit(1); diff --git a/example/shared.h b/example/shared.h index 48eca538..c95df9cc 100644 --- a/example/shared.h +++ b/example/shared.h @@ -1,6 +1,8 @@ #ifndef _EXAMPLE_SHARED_H #define _EXAMPLE_SHARED_H -#define _POSIX_C_SOURCE 199309L +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200112L +#endif #include #include #include -- cgit v1.2.3