1WL_DISPLAY_CONNECT(3) wl_display_connect WL_DISPLAY_CONNECT(3)
2
3
4
6 wl_display_connect, wl_display_connect_to_fd - Connect to a Wayland
7 socket
8
10 #include <wayland-client.h>
11
12 struct wl_display *wl_display_connect(const char *name);
13
14 struct wl_display *wl_display_connect_to_fd(int fd);
15
17 wl_display_connect connects to a Wayland socket that was previously
18 opened by a Wayland server. The server socket must be placed in
19 XDG_RUNTIME_DIR when WAYLAND_DISPLAY (or name, see below) is a simple
20 name, for this function to find it. The server socket is also allowed
21 to exist at an arbitrary path; usage details follow. See below for
22 compatibility issue details.
23
24 The name argument specifies the name of the socket or NULL to use the
25 default (which is "wayland-0"). The environment variable
26 WAYLAND_DISPLAY replaces the default value. If name is an absolute
27 path, then that path is used as the Wayland socket to which the
28 connection is attempted. Note that in combination with the
29 default-value behavior described above, this implies that setting
30 WAYLAND_DISPLAY to an absolute path will implicitly cause name to take
31 on that absolute path if name is NULL. If WAYLAND_SOCKET is set, this
32 function behaves like wl_display_connect_to_fd with the file-descriptor
33 number taken from the environment variable.
34
35 Support for interpreting WAYLAND_DISPLAY as an absolute path is a
36 change in behavior compared to wl_display_connect's behavior in
37 versions 1.14 and older of Wayland. It is no longer guaranteed in
38 versions 1.15 and higher that the Wayland socket chosen is equivalent
39 to manually constructing a socket pathname by concatenating
40 XDG_RUNTIME_DIR and WAYLAND_DISPLAY. Manual construction of the socket
41 path must account for the possibility that WAYLAND_DISPLAY contains an
42 absolute path.
43
44 wl_display_connect_to_fd connects to a Wayland socket with an explicit
45 file-descriptor. The file-descriptor is passed as argument fd.
46
48 wl_display_connect and wl_display_connect_to_fd return a new display
49 context object or NULL on failure. errno is set correspondingly.
50
52 wayland-client(7), wl_display_disconnect(3), wl_display_iterate(3)
53
54
55
56wayland-client September 2012 WL_DISPLAY_CONNECT(3)