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

Maksim Melnikau maxposedon at gmail.com
Tue Aug 13 13:39:52 PDT 2013


The motivation behind the patch is simple. Many distros how adding
wayland/weston to their packages, but they don't add xorg-server with
wayland support. As result weston installed with --with-xserver-path
(XSERVER_PATH) points to useless Xorg for xwayland integration (
https://bugs.gentoo.org/show_bug.cgi?id=480868 ). With this patch it will
be easy to follow this instructions (
http://wayland.freedesktop.org/xserver.html) for installing in home just
xorg-server-xwayland-1.12 and drivers for starting weston/wayland
experiments.




On Tue, Aug 13, 2013 at 11:08 PM, Maksim Melnikau <maxposedon at gmail.com>wrote:

> 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");
>         clearenv();
>         if (term)
>                 setenv("TERM", term, 1);
> +       if(xserver)
> +               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)
> +                         xserver = XSERVER_PATH;
> +
> +               if (execl(xserver,
> +                         xserver,
>                           display,
>                           "-wayland",
>                           "-rootless",
> --
> 1.8.3.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130813/3a28a9c5/attachment.html>


More information about the wayland-devel mailing list