diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-06-21 14:33:39 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-06-21 14:33:39 -0400 |
commit | 8ce9237c928a7dc6afb889291237465daf4d6b43 (patch) | |
tree | ed5edc68f56e27cb0c7cec0a4e486c1992582672 /example | |
parent | b93f00b92f20dcdc5360605649a142551bd837a9 (diff) |
Create WAYLAND_DISPLAY socket
Diffstat (limited to 'example')
-rw-r--r-- | example/shared.c | 5 | ||||
-rw-r--r-- | example/shared.h | 4 |
2 files changed, 7 insertions, 2 deletions
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 <string.h> #include <stdlib.h> #include <time.h> @@ -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 <time.h> #include <stdbool.h> #include <xkbcommon/xkbcommon.h> |