


XOpenDisplay(3X11)					   XOpenDisplay(3X11)
X11R5									X11R5



Name
  XOpenDisplay,	XCloseDisplay -	connect	or disconnect to X server

Syntax
  Display *XOpenDisplay(_d_i_s_p_l_a_y__n_a_m_e)
     char *_d_i_s_p_l_a_y__n_a_m_e;

  XCloseDisplay(_d_i_s_p_l_a_y)
     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 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, if supported by your system, 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 attempts	to connect 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 attempts to connect
  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 informa-
  tion about using macros and functions	to obtain information from the
  _D_i_s_p_l_a_y structure, see section 2.2.1 in _X _W_i_n_d_o_w _S_y_s_t_e_m: _T_h_e _C_o_m_p_l_e_t_e
  _R_e_f_e_r_e_n_c_e, Second Edition, Robert W. Scheifler and James Gettys.

  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 _W_i_n_d_o_w _S_y_s_t_e_m: _T_h_e _C_o_m_p_l_e_t_e	_R_e_f_e_r_e_n_c_e, Second Edition, Robert W.
  Scheifler and	James Gettys delim off






























































