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

<p dir="ltr">Hope that helps,<br>
--Jason Ekstrand</p>
<p dir="ltr">><br>
> Cheers,<br>
> Emilio<br>
><br>
> [1] <a href="https://bugzilla.gnome.org/show_bug.cgi?id=719989">https://bugzilla.gnome.org/show_bug.cgi?id=719989</a><br>
> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</p>