NAME
XOpenDisplay, XCloseDisplay - connect or disconnect to X server
SYNTAX
Display *XOpenDisplay(char *_d_i_s_p_l_a_y___n_a_m_e);
int XCloseDisplay(Display *_d_i_s_p_l_a_y);
ARGUMENTS
-
_d_i_s_p_l_a_y
Specifies the connection to the X server.
-
-
_d_i_s_p_l_a_y___n_a_m_e
Specifies the hardware display name, which determines the display
-
and communications domain to be used.
On a POSIX-conformant system, if the display_name is NULL,
it defaults to the value of the DISPLAY environment variable.
DESCRIPTION
The
_X_O_p_e_n_D_i_s_p_l_a_y
function returns a
_D_i_s_p_l_a_y
structure that serves as the
connection to the X server and that contains all the information
about that X server.
_X_O_p_e_n_D_i_s_p_l_a_y
connects your application to the X server through TCP
or DECnet communications protocols,
or through some local inter-process communication protocol.
If the hostname is a host machine name and a single colon (:)
separates the hostname and display number,
_X_O_p_e_n_D_i_s_p_l_a_y
connects using TCP streams.
If the hostname is not specified,
Xlib uses whatever it believes is the fastest transport.
If the hostname is a host machine name and a double colon (::)
separates the hostname and display number,
_X_O_p_e_n_D_i_s_p_l_a_y
connects using DECnet.
A single X server can support any or all of these transport mechanisms
simultaneously.
A particular Xlib implementation can support many more of these transport
mechanisms.
If successful,
_X_O_p_e_n_D_i_s_p_l_a_y
returns a pointer to a
_D_i_s_p_l_a_y
structure,
which is defined in
<_X_1_1_/_X_l_i_b_._h>.
If
_X_O_p_e_n_D_i_s_p_l_a_y
does not succeed, it returns NULL.
After a successful call to
_X_O_p_e_n_D_i_s_p_l_a_y,
all of the screens in the display can be used by the client.
The screen number specified in the display_name argument is returned
by the
_D_e_f_a_u_l_t_S_c_r_e_e_n
macro (or the
_X_D_e_f_a_u_l_t_S_c_r_e_e_n
function).
You can access elements of the
_D_i_s_p_l_a_y
and
_S_c_r_e_e_n
structures only by using the information macros or functions.
For information about using macros and functions to obtain information from
the
_D_i_s_p_l_a_y
structure,
see section 2.2.1.
The
_X_C_l_o_s_e_D_i_s_p_l_a_y
function closes the connection to the X server for the display specified in the
_D_i_s_p_l_a_y
structure and destroys all windows, resource IDs
(_W_i_n_d_o_w,
_F_o_n_t,
_P_i_x_m_a_p,
_C_o_l_o_r_m_a_p,
_C_u_r_s_o_r,
and
_G_C_o_n_t_e_x_t),
or other resources that the client has created
on this display, unless the close-down mode of the resource has been changed
(see
_X_S_e_t_C_l_o_s_e_D_o_w_n_M_o_d_e).
Therefore, these windows, resource IDs, and other resources should never be
referenced again or an error will be generated.
Before exiting, you should call
_X_C_l_o_s_e_D_i_s_p_l_a_y
explicitly so that any pending errors are reported as
_X_C_l_o_s_e_D_i_s_p_l_a_y
performs a final
_X_S_y_n_c
operation.
_X_C_l_o_s_e_D_i_s_p_l_a_y
can generate a
_B_a_d_G_C
error.
SEE ALSO
AllPlanes(3X11),
XFlush(3X11),
XSetCloseDownMode(3X11)
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e