1XOpenDisplay(3) XLIB FUNCTIONS XOpenDisplay(3)
2
3
4
6 XOpenDisplay, XCloseDisplay - connect or disconnect to X server
7
9 Display *XOpenDisplay(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 If XOpenDisplay does not succeed, it returns NULL.
39 After a successful call to XOpenDisplay, all of the screens in the dis‐
40 play can be used by the client. The screen number specified in the
41 display_name argument is returned by the DefaultScreen macro (or the
42 XDefaultScreen function). You can access elements of the Display and
43 Screen structures only by using the information macros or functions.
44 For information about using macros and functions to obtain information
45 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 Font, Pixmap, Colormap, Cursor, and GContext), or
50 other resources that the client has created on this display, unless the
51 close-down mode of the resource has been changed (see XSetCloseDown‐
52 Mode). Therefore, these windows, resource IDs, and other resources
53 should never be referenced again or an error will be generated. Before
54 exiting, you should call XCloseDisplay explicitly so that any pending
55 errors are reported as XCloseDisplay performs a final XSync operation.
56
57 XCloseDisplay can generate a BadGC error.
58
60 AllPlanes(3), XFlush(3), XSetCloseDownMode(3)
61 Xlib - C Language X Interface
62
63
64
65X Version 11 libX11 1.6.9 XOpenDisplay(3)