[PATCH 1/2] compositor: Add a comment around the WAYLAND_DISPLAY envvar setting

Pekka Paalanen ppaalanen at gmail.com
Wed May 7 06:55:22 PDT 2014


On Wed,  7 May 2014 09:07:26 -0400
"Jasper St. Pierre" <jstpierre at mecheye.net> wrote:

> This took me a few minutes to figure out, so document it for the
> next person who stumbles in here.
> ---
>  src/compositor.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 3d65e4c..120818f 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -4245,7 +4245,13 @@ int main(int argc, char *argv[])
>  	ec->idle_time = idle_time;
>  	ec->default_pointer_grab = NULL;
>  
> -	setenv("WAYLAND_DISPLAY", socket_name, 1);
> +	if (socket_name) {
> +		setenv("WAYLAND_DISPLAY", socket_name, 1);
> +	} else {
> +		/* Overwrite WAYLAND_DISPLAY so that nested Weston
> +		 * instances don't try to open the parent's socket. */
> +		setenv("WAYLAND_DISPLAY", NULL, 1);
> +	}
>  
>  	if (option_shell)
>  		shell = strdup(option_shell);

Hi,

this seems a little strange to me. How could socket_name ever be NULL?

I think the compositor needs to set WAYLAND_DISPLAY always, so that
clients have it in their environment, like weston-desktop-shell and so
everything.

The only case where WAYLAND_DISPLAY should be cleared is when the
WAYLAND_SERVER_SOCKET thing prevents the normal socket from being
created. I don't see that matching with socket_name==NULL.

I already mentioned on IRC about the setenv(..., NULL, 1).


Thanks,
pq


More information about the wayland-devel mailing list