Create WAYLAND_DISPLAY socket

This commit is contained in:
Drew DeVault 2017-06-21 14:33:39 -04:00
parent b93f00b92f
commit 8ce9237c92
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#define _POSIX_C_SOURCE 199309L #define _POSIX_C_SOURCE 200112L
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
@ -460,6 +460,9 @@ void compositor_init(struct compositor_state *state) {
clock_gettime(CLOCK_MONOTONIC, &state->last_frame); 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)) { if (!wlr_backend_init(state->backend)) {
wlr_log(L_ERROR, "Failed to initialize backend"); wlr_log(L_ERROR, "Failed to initialize backend");
exit(1); exit(1);

View File

@ -1,6 +1,8 @@
#ifndef _EXAMPLE_SHARED_H #ifndef _EXAMPLE_SHARED_H
#define _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 <time.h>
#include <stdbool.h> #include <stdbool.h>
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>