wl_display_connect() falling back to wayland-0

Jason Ekstrand jason at jlekstrand.net
Wed Dec 11 07:18:48 PST 2013

Hi Emilio,

On Dec 9, 2013 6:38 AM, "Emilio Pozuelo Monfort" <pochu27 at gmail.com> wrote:
> Hi,
> I was looking at making gtk+ try the wayland backend before the x11 one
> This would solve the problem where every gtk+ app uses the x11 backend
> XWayland when the latter is available.
> As you can read on comment #3 and in the patch from comment #1,
> wl_display_connect() currently falls back to wayland-0 if WAYLAND_DISPLAY
is not
> in the environment, which causes the wayland backend initialization to
> when running from X11 while weston is running (whether in a different tty
or in
> an X11 window).
> The workaround I'm using in gtk+ is to directly fail the wayland backend
> initialization if WAYLAND_DISPLAY is not set, as Pekka suggested to me.
> works nicely, making gtk+ apps use the x11 backend when launched from
> X11, and use the wayland backend when started within weston.
> So my question is: why are we falling back to wayland-0 when
> isn't set? Is this so that one can easily/quickly run apps from a tty for
> debugging purposes?

Why do we have a fallback? I don't know. It doesn't seem that hard to just
set WAYLAND_DISPLAY if you want to run from another terminal.

Why is the fallback  wayland-0?  I think that's the obvious choice?

How do you work around it?  What you got from Pekka is half right. You need
to check for both WAYLAND_DISPLAY and WAYLAND_SOCKET.  The former is the
catch-all "connect to this socket; it lives in XDG_RUNTIME_DIR."  The other
is a mechanism for passing the client a specific file descriptor that it is
expected to use for it's connection. This is usually used for launching
trusted clients such as the panel.

Hope that helps,
--Jason Ekstrand

> Cheers,
> Emilio
> [1] https://bugzilla.gnome.org/show_bug.cgi?id=719989
> _______________________________________________
> 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/20131211/abdb9a41/attachment.html>

More information about the wayland-devel mailing list