wayland/doc/man/wl_display_connect.xml

113 lines
4.5 KiB
XML
Raw Normal View History

<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
Written 2012 by David Herrmann <dh.herrmann@googlemail.com>
Dedicated to the Public Domain
-->
<refentry id="wl_display_connect">
<refentryinfo>
<title>wl_display_connect</title>
<productname>wayland-client</productname>
<date>September 2012</date>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>David</firstname>
<surname>Herrmann</surname>
<email>dh.herrmann@googlemail.com</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>wl_display_connect</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>wl_display_connect</refname>
<refname>wl_display_connect_to_fd</refname>
<refpurpose>Connect to a Wayland socket</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;wayland-client.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>struct wl_display *<function>wl_display_connect</function></funcdef>
<paramdef>const char *<parameter>name</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>struct wl_display *<function>wl_display_connect_to_fd</function></funcdef>
<paramdef>int <parameter>fd</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>wl_display_connect</function> connects to a Wayland socket
that was previously opened by a Wayland server. The server socket must
client: Allow absolute paths in WAYLAND_DISPLAY In order to support system compositor instances, it is necessary to allow clients' wl_display_connect() to find the compositor's listening socket somewhere outside of XDG_RUNTIME_DIR. For a full account, see the discussion beginning here: https://lists.freedesktop.org/archives/wayland-devel/2017-November/035664.html This change adjusts the client-side connection logic so that, if WAYLAND_DISPLAY is formatted as an absolute pathname, the socket connection attempt is made to just $WAYLAND_DISPLAY rather than usual user-private location $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY. This change is based on Davide Bettio's submission of the same concept at: https://lists.freedesktop.org/archives/wayland-devel/2015-August/023838.html. v4 changes: * Improved internal comments and some boundary-condition error checks in test case. * Refer to compositor as "Wayland server" rather than "Wayland display" in wl_display_connect() doxygen comments. * Remove redundant descriptions of parameter-interpretation mechanics from wl_display_connect() manpage. Reworked things to make it clear that 'name' and $WAYLAND_DISLAY are each capable of encoding absolute server socket paths. * Remove callout to reference implementation behavior in protocol documented. In its place there is now a simple statement that implementations can optionally support absolute socket paths. v3 changes: * Added test case. * Clarified documentation to note that 'name' parameter to wl_display_connect() can also be an absolute path. v2 changes: * Added backward incompatibility note to wl_display_connect() manpage. * Rephased wl_display_connect() manpage changes to precisely match actual changed behavior. * Added mention of new absolute path behavior in wl_display_connect() doxygen comments. * Mentioned new absolute path interpretation of WAYLAND_DISPLAY in protocol documentation. Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com> Acked-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 08:54:54 -06:00
be placed in <envar>XDG_RUNTIME_DIR</envar> when <envar>WAYLAND_DISPLAY</envar>
(or <varname>name</varname>, see below) is a simple name, for this
function to find it. The server socket is also allowed to exist at an
arbitrary path; usage details follow. See below for compatibility issue
details.</para>
<para>The <varname>name</varname> argument specifies the name of
Revert "client: require WAYLAND_DISPLAY to be set" This reverts commit fb7e13021730d0a5516ecbd3712ea4235e05d24d. Developers have been trying to reduce the number of by default required environment variables, and the mentioned commit is a step backwards in that sense. The fundamental assumption is that a user has only one main (Wayland) display server where all programs should connect to by default, and do so with an a priori known socket name. The commit also broke various use cases in the wild, some accidentally due to other causes, some intentionally. This revert allows those use cases to continue. The original problem of running Weston in a window in an existing GNOME X11 session and getting applications unintentionally launched into Weston can be circumvented by letting Weston use a non-default socket name, leaving wayland-0 unused. Discussion: http://lists.freedesktop.org/archives/wayland-devel/2015-August/023927.html http://lists.freedesktop.org/archives/wayland-devel/2015-August/023937.html Cc: Dima Ryazanov <dima@gmail.com> Cc: Giulio Camuffo <giuliocamuffo@gmail.com> Cc: Daniel Stone <daniel@fooishbar.org> Cc: Jasper St. Pierre <jstpierre@mecheye.net> Cc: Ryo Munakata <ryomnktml@gmail.com> Cc: Ray Strode <halfline@gmail.com> Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Matthias Clasen <mclasen@redhat.com> Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Acked-by: Ray Strode <rstrode@redhat.com> Acked-by: Dima Ryazanov <dima@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Acked-By: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Acked-By: Ryo Munakata <ryomnktml@gmail.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-17 15:20:28 +03:00
the socket or <constant>NULL</constant> to use the default (which is
<constant>"wayland-0"</constant>). The environment variable
client: Allow absolute paths in WAYLAND_DISPLAY In order to support system compositor instances, it is necessary to allow clients' wl_display_connect() to find the compositor's listening socket somewhere outside of XDG_RUNTIME_DIR. For a full account, see the discussion beginning here: https://lists.freedesktop.org/archives/wayland-devel/2017-November/035664.html This change adjusts the client-side connection logic so that, if WAYLAND_DISPLAY is formatted as an absolute pathname, the socket connection attempt is made to just $WAYLAND_DISPLAY rather than usual user-private location $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY. This change is based on Davide Bettio's submission of the same concept at: https://lists.freedesktop.org/archives/wayland-devel/2015-August/023838.html. v4 changes: * Improved internal comments and some boundary-condition error checks in test case. * Refer to compositor as "Wayland server" rather than "Wayland display" in wl_display_connect() doxygen comments. * Remove redundant descriptions of parameter-interpretation mechanics from wl_display_connect() manpage. Reworked things to make it clear that 'name' and $WAYLAND_DISLAY are each capable of encoding absolute server socket paths. * Remove callout to reference implementation behavior in protocol documented. In its place there is now a simple statement that implementations can optionally support absolute socket paths. v3 changes: * Added test case. * Clarified documentation to note that 'name' parameter to wl_display_connect() can also be an absolute path. v2 changes: * Added backward incompatibility note to wl_display_connect() manpage. * Rephased wl_display_connect() manpage changes to precisely match actual changed behavior. * Added mention of new absolute path behavior in wl_display_connect() doxygen comments. * Mentioned new absolute path interpretation of WAYLAND_DISPLAY in protocol documentation. Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com> Acked-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 08:54:54 -06:00
<envar>WAYLAND_DISPLAY</envar> replaces the default value.
If <varname>name</varname> is an absolute path, then that path is used
as the Wayland socket to which the connection is attempted. Note that
in combination with the default-value behavior described above, this
implies that setting <envar>WAYLAND_DISPLAY</envar> to an absolute
path will implicitly cause <varname>name</varname> to take on that
absolute path if <varname>name</varname> is <constant>NULL</constant>.
If <envar>WAYLAND_SOCKET</envar> is set, this function behaves like
<function>wl_display_connect_to_fd</function> with the file-descriptor
number taken from the environment variable.</para>
client: Allow absolute paths in WAYLAND_DISPLAY In order to support system compositor instances, it is necessary to allow clients' wl_display_connect() to find the compositor's listening socket somewhere outside of XDG_RUNTIME_DIR. For a full account, see the discussion beginning here: https://lists.freedesktop.org/archives/wayland-devel/2017-November/035664.html This change adjusts the client-side connection logic so that, if WAYLAND_DISPLAY is formatted as an absolute pathname, the socket connection attempt is made to just $WAYLAND_DISPLAY rather than usual user-private location $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY. This change is based on Davide Bettio's submission of the same concept at: https://lists.freedesktop.org/archives/wayland-devel/2015-August/023838.html. v4 changes: * Improved internal comments and some boundary-condition error checks in test case. * Refer to compositor as "Wayland server" rather than "Wayland display" in wl_display_connect() doxygen comments. * Remove redundant descriptions of parameter-interpretation mechanics from wl_display_connect() manpage. Reworked things to make it clear that 'name' and $WAYLAND_DISLAY are each capable of encoding absolute server socket paths. * Remove callout to reference implementation behavior in protocol documented. In its place there is now a simple statement that implementations can optionally support absolute socket paths. v3 changes: * Added test case. * Clarified documentation to note that 'name' parameter to wl_display_connect() can also be an absolute path. v2 changes: * Added backward incompatibility note to wl_display_connect() manpage. * Rephased wl_display_connect() manpage changes to precisely match actual changed behavior. * Added mention of new absolute path behavior in wl_display_connect() doxygen comments. * Mentioned new absolute path interpretation of WAYLAND_DISPLAY in protocol documentation. Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com> Acked-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-11-27 08:54:54 -06:00
<para>Support for interpreting <envar>WAYLAND_DISPLAY</envar> as an
absolute path is a change in behavior compared to
<function>wl_display_connect</function>'s behavior in versions
1.14 and older of Wayland. It is no longer guaranteed in versions
1.15 and higher that the Wayland socket chosen is equivalent to
manually constructing a socket pathname by concatenating
<envar>XDG_RUNTIME_DIR</envar> and <envar>WAYLAND_DISPLAY</envar>.
Manual construction of the socket path must account for the
possibility that <envar>WAYLAND_DISPLAY</envar> contains an absolute
path.</para>
<para><function>wl_display_connect_to_fd</function> connects to a Wayland
socket with an explicit file-descriptor. The file-descriptor is passed
as argument <varname>fd</varname>.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para><function>wl_display_connect</function> and
<function>wl_display_connect_to_fd</function> return a new display
context object or NULL on failure. <varname>errno</varname> is set
correspondingly.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>wayland-client</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
<citerefentry><refentrytitle>wl_display_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>wl_display_iterate</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>