[PATCH 2/3] 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.

Davide Bettio davide.bettio at ispirata.com
Tue Mar 3 04:49:54 PST 2015


Signed-off-by: Davide Bettio <davide.bettio at ispirata.com>
---
 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 eefbe35..05e9c07 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1216,9 +1216,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
@@ -1241,6 +1241,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