1XOpenDisplay(3) XLIB FUNCTIONS XOpenDisplay(3)
2
3
4
6 XOpenDisplay, XCloseDisplay - connect or disconnect to X server
7
9 Display *XOpenDisplay(_Xconst char *display_name);
10
11 int XCloseDisplay(Display *display);
12
14 display Specifies the connection to the X server.
15
16 display_name
17 Specifies the hardware display name, which determines the
18 display and communications domain to be used. On a POSIX-
19 conformant system, if the display_name is NULL, it defaults
20 to the value of the DISPLAY environment variable.
21
23 The XOpenDisplay function returns a Display structure that serves as
24 the connection to the X server and that contains all the information
25 about that X server. XOpenDisplay connects your application to the X
26 server through TCP or DECnet communications protocols, or through some
27 local inter-process communication protocol. If the hostname is a host
28 machine name and a single colon (:) separates the hostname and display
29 number, XOpenDisplay connects using TCP streams. If the hostname is
30 not specified, Xlib uses whatever it believes is the fastest transport.
31 If the hostname is a host machine name and a double colon (::) sepa‐
32 rates the hostname and display number, XOpenDisplay connects using DEC‐
33 net. A single X server can support any or all of these transport mech‐
34 anisms simultaneously. A particular Xlib implementation can support
35 many more of these transport mechanisms.
36
37 If successful, XOpenDisplay returns a pointer to a Display structure,
38 which is defined in X11/Xlib.h. If XOpenDisplay does not succeed, it
39 returns NULL. After a successful call to XOpenDisplay, all of the
40 screens in the display can be used by the client. The screen number
41 specified in the display_name argument is returned by the DefaultScreen
42 macro (or the XDefaultScreen function). You can access elements of the
43 Display and Screen structures only by using the information macros or
44 functions. For information about using macros and functions to obtain
45 information from the Display structure, see section 2.2.1.
46
47 The XCloseDisplay function closes the connection to the X server for
48 the display specified in the Display structure and destroys all win‐
49 dows, resource IDs (Window, Font, Pixmap, Colormap, Cursor, and GCon‐
50 text), or other resources that the client has created on this display,
51 unless the close-down mode of the resource has been changed (see XSet‐
52 CloseDownMode). Therefore, these windows, resource IDs, and other re‐
53 sources should never be referenced again or an error will be generated.
54 Before exiting, you should call XCloseDisplay explicitly so that any
55 pending errors are reported as XCloseDisplay performs a final XSync op‐
56 eration.
57
58 XCloseDisplay can generate a BadGC error.
59
61 AllPlanes(3), XFlush(3), XSetCloseDownMode(3)
62 Xlib - C Language X Interface
63
64
65
66X Version 11 libX11 1.7.3.1 XOpenDisplay(3)