1<?xml version='1.0'?> <!--*-nxml-*--> 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 4 5<!-- 6 Written 2012 by David Herrmann <dh.herrmann@googlemail.com> 7 Dedicated to the Public Domain 8--> 9 10<refentry id="wl_display_connect"> 11 <refentryinfo> 12 <title>wl_display_connect</title> 13 <productname>wayland-client</productname> 14 <date>September 2012</date> 15 <authorgroup> 16 <author> 17 <contrib>Developer</contrib> 18 <firstname>David</firstname> 19 <surname>Herrmann</surname> 20 <email>dh.herrmann@googlemail.com</email> 21 </author> 22 </authorgroup> 23 </refentryinfo> 24 25 <refmeta> 26 <refentrytitle>wl_display_connect</refentrytitle> 27 <manvolnum>3</manvolnum> 28 </refmeta> 29 30 <refnamediv> 31 <refname>wl_display_connect</refname> 32 <refname>wl_display_connect_to_fd</refname> 33 <refpurpose>Connect to a Wayland socket</refpurpose> 34 </refnamediv> 35 36 <refsynopsisdiv> 37 <funcsynopsis> 38 39 <funcsynopsisinfo>#include <wayland-client.h></funcsynopsisinfo> 40 41 <funcprototype> 42 <funcdef>struct wl_display *<function>wl_display_connect</function></funcdef> 43 <paramdef>const char *<parameter>name</parameter></paramdef> 44 </funcprototype> 45 46 <funcprototype> 47 <funcdef>struct wl_display *<function>wl_display_connect_to_fd</function></funcdef> 48 <paramdef>int <parameter>fd</parameter></paramdef> 49 </funcprototype> 50 51 </funcsynopsis> 52 </refsynopsisdiv> 53 54 <refsect1> 55 <title>Description</title> 56 <para><function>wl_display_connect</function> connects to a Wayland socket 57 that was previously opened by a Wayland server. The server socket must 58 be placed in <envar>XDG_RUNTIME_DIR</envar> for this function to 59 find it. The <varname>name</varname> argument specifies the name of 60 the socket or <constant>NULL</constant> to use the default (which is 61 <constant>"wayland-0"</constant>). The environment variable 62 <envar>WAYLAND_DISPLAY</envar> replaces the default value. If 63 <envar>WAYLAND_SOCKET</envar> is set, this function behaves like 64 <function>wl_display_connect_to_fd</function> with the file-descriptor 65 number taken from the environment variable.</para> 66 67 <para><function>wl_display_connect_to_fd</function> connects to a Wayland 68 socket with an explicit file-descriptor. The file-descriptor is passed 69 as argument <varname>fd</varname>.</para> 70 </refsect1> 71 72 <refsect1> 73 <title>Return Value</title> 74 <para><function>wl_display_connect</function> and 75 <function>wl_display_connect_to_fd</function> return a new display 76 context object or NULL on failure. <varname>errno</varname> is set 77 correspondingly.</para> 78 </refsect1> 79 80 <refsect1> 81 <title>See Also</title> 82 <para> 83 <citerefentry><refentrytitle>wayland-client</refentrytitle><manvolnum>7</manvolnum></citerefentry>, 84 <citerefentry><refentrytitle>wl_display_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 85 <citerefentry><refentrytitle>wl_display_iterate</refentrytitle><manvolnum>3</manvolnum></citerefentry> 86 </para> 87 </refsect1> 88</refentry> 89