2012-09-24 13:18:38 +02:00
|
|
|
<?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>
|
2013-04-04 11:28:57 +10:00
|
|
|
<refpurpose>Connect to a Wayland socket</refpurpose>
|
2012-09-24 13:18:38 +02:00
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
|
|
|
|
|
<funcsynopsisinfo>#include <wayland-client.h></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>
|
2013-04-04 11:28:57 +10:00
|
|
|
<para><function>wl_display_connect</function> connects to a Wayland socket
|
|
|
|
|
that was previously opened by a Wayland server. The server socket must
|
2012-09-24 13:18:38 +02:00
|
|
|
be placed in <envar>XDG_RUNTIME_DIR</envar> for this function to
|
|
|
|
|
find it. The <varname>name</varname> argument specifies the name of
|
client: require WAYLAND_DISPLAY to be set
Although defaulting to wayland-0 seems convenient, it has an undesirable
side effect: clients may unintentionally connect to the wrong compositor.
Generally, it's safer to fail instead. Here's a real example:
In Fedora 22, Gtk+ prefers Wayland over X11, though the default session is still
a normal X11 Gnome session. When you launch a Gtk+ app, it will try Wayland,
fail, then try X11, and succesfully start up. That works fine.
Now suppose you launch Weston while running the Gnome session. Suddenly, all
of the Gtk+ apps launched from Gnome will show up inside Weston instead.
That's unexpected. There's also no good way to prevent that from happening
(other than perhaps setting WAYLAND_DISPLAY to an invalid value when launching
an app).
Not using wayland-0 as the default will solve that problem: an app launched
from the X11 Gnome session will use the X11 backend regardless of whether
there's a wayland compositor running at the same time.
Everything else should work as before. The compositor already sets
the WAYLAND_DISPLAY when starting the session, so the lack of the default value
should not make a difference to the user.
Signed-off-by: Dima Ryazanov <dima@gmail.com>
Acked-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
[Pekka: dropped the wayland-server.c hunk, adjusted summary]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-08-12 19:34:31 -07:00
|
|
|
the socket or <constant>NULL</constant> to use the default
|
|
|
|
|
(which is the value of <envar>WAYLAND_DISPLAY</envar>). If
|
2012-09-24 13:18:38 +02:00
|
|
|
<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>
|
|
|
|
|
|
2013-04-04 11:28:57 +10:00
|
|
|
<para><function>wl_display_connect_to_fd</function> connects to a Wayland
|
2012-09-24 13:18:38 +02:00
|
|
|
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>
|