[PATCH wayland 2/2] Introduce WAYLAND_SERVER_SOCKET to change the path where the server will create the socket.

Davide Bettio davide.bettio at ispirata.com
Tue Jul 28 08:51:44 PDT 2015


Introduce WAYLAND_SERVER_SOCKET to change the path where
the server will create the socket. It will be possible for a nested
compositor to offer a socket located on WAYLAND_SERVER_SOCKET path while
connecting to the main compositor socket that is located on 
WAYLAND_DISPLAY
path.

---
  src/wayland-server.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index d9949d2..d73792a 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1221,9 +1221,9 @@ wl_display_add_socket_auto(struct wl_display 
*display)
   * This adds a Unix socket to Wayland display which can be used by 
clients to
   * connect to Wayland display.
   *
- * If NULL is passed as name, then it would look for WAYLAND_DISPLAY 
env
- * variable for the socket name. If WAYLAND_DISPLAY is not set, then 
default
- * wayland-0 is used.
+ * If NULL is passed as name, then it would look in order for 
WAYLAND_SERVER_SOCKET
+ * and WAYLAND_DISPLAY env variable for the socket name. If 
WAYLAND_DISPLAY and
+ * WAYLAND_SERVER_SOCKET are not set, then default wayland-0 is used.
   *
   * The Unix socket will be created in the directory pointed to by 
environment
   * variable XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not set, then this 
function
@@ -1246,6 +1246,8 @@ wl_display_add_socket(struct wl_display *display, 
const char *name)
  		return -1;

  	if (name == NULL)
+		name = getenv("WAYLAND_SERVER_SOCKET");
+	if (name == NULL)
  		name = getenv("WAYLAND_DISPLAY");
  	if (name == NULL)
  		name = "wayland-0";
-- 
2.1.0




More information about the wayland-devel mailing list