[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.
Pekka Paalanen
ppaalanen at gmail.com
Tue Dec 22 02:59:16 PST 2015
On Tue, 3 Mar 2015 13:49:54 +0100
Davide Bettio <davide.bettio at ispirata.com> wrote:
> 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";
Hi Davide,
there is no longer a need to play with these environment variables
trying to contort libwayland-server to create a socket like you want it.
http://cgit.freedesktop.org/wayland/wayland/commit/?id=225830dcb8bf1a6583d0f4ca182584024783923e
"server: Add a socket with an existing fd"
You can create the socket any way you want, and have libwayland-server
start answering connections on it.
Mind, that nested Wayland or mini-compositor setups are better off
creating the connection with socketpair(2) and using WAYLAND_SOCKET
environment variable per client process, because then you control
exactly which processes can be connected.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20151222/86de6130/attachment-0001.sig>
More information about the wayland-devel
mailing list