[PATCH] add ENV[XSERVER_PATH] to change xserver runtime

Giulio Camuffo giuliocamuffo at gmail.com
Tue Aug 13 14:17:47 PDT 2013


Thanks, every time I tried XWayland I though a thing like this was needed.
I have a few comments though:


2013/8/13 Maksim Melnikau <maxposedon at gmail.com>

> Signed-off-by: Maksim Melnikau <maxposedon at gmail.com>
> ---
>  man/weston.man          | 3 +++
>  src/weston-launch.c     | 4 ++++
>  src/xwayland/launcher.c | 9 +++++++--
>  3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/man/weston.man b/man/weston.man
> index 39d854b..94c87d3 100644
> --- a/man/weston.man
> +++ b/man/weston.man
> @@ -240,6 +240,9 @@ If set, specifies the directory where to look for
>  .B XDG_RUNTIME_DIR
>  The directory for Weston's socket and lock files.
>  Wayland clients will automatically use this.
> +.TP
> +.B XSERVER_PATH
> +Override xserver to run.
>  .
>  .\" ***************************************************************
>  .SH DIAGNOSTICS
> diff --git a/src/weston-launch.c b/src/weston-launch.c
> index 7264f7e..2b26c9c 100644
> --- a/src/weston-launch.c
> +++ b/src/weston-launch.c
> @@ -504,6 +504,7 @@ setup_session(struct weston_launch *wl)
>  {
>         char **env;
>         char *term;
> +       char *xserver;
>         int i;
>
>         if (wl->tty != STDIN_FILENO) {
> @@ -514,9 +515,12 @@ setup_session(struct weston_launch *wl)
>         }
>
>         term = getenv("TERM");
> +       xserver = getenv("XSERVER_PATH");
>
I'm not sure XSERVER_PATH is a good name. I would at least put a WESTON_ or
before it, as it's specific to it.


>         clearenv();
>         if (term)
>                 setenv("TERM", term, 1);
> +       if(xserver)
>
style: put a space after the 'if'.


> +               setenv("XSERVER_PATH", xserver, 1);
>         setenv("USER", wl->pw->pw_name, 1);
>         setenv("LOGNAME", wl->pw->pw_name, 1);
>         setenv("HOME", wl->pw->pw_dir, 1);
> diff --git a/src/xwayland/launcher.c b/src/xwayland/launcher.c
> index b639479..ae1fcb1 100644
> --- a/src/xwayland/launcher.c
> +++ b/src/xwayland/launcher.c
> @@ -42,6 +42,7 @@ weston_xserver_handle_event(int listen_fd, uint32_t
> mask, void *data)
>         struct weston_xserver *wxs = data;
>         char display[8], s[8];
>         int sv[2], client_fd;
> +       char *xserver = NULL;
>
>         if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
>                 weston_log("socketpair failed\n");
> @@ -62,8 +63,12 @@ weston_xserver_handle_event(int listen_fd, uint32_t
> mask, void *data)
>
>                 snprintf(display, sizeof display, ":%d", wxs->display);
>
> -               if (execl(XSERVER_PATH,
> -                         XSERVER_PATH,
> +               xserver = getenv("XSERVER_PATH");
> +               if(!xserver)
>
also here.


> +                         xserver = XSERVER_PATH;
> +
> +               if (execl(xserver,
> +                         xserver,
>                           display,
>                           "-wayland",
>                           "-rootless",
> --
> 1.8.3.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130813/9fa3de5a/attachment.html>


More information about the wayland-devel mailing list