next up previous contents
Next: Finding out about the Up: Starting Up Previous: Starting Up

Opening a Display Server

Before any windows can be used it is necessary to establish a connection with a display server. A server is identified by the name of the machine it is on and the display number on that machine. If the server name string is NULL then the contents of the DISPLAY environment variable is substituted to determine which display to use. The full display name has the form hostname:display_number.screen. Multiple screens/terminals can be controlled by a single X server as long as they are on the same display; i.e. they are controlled with a single mouse and a single keyboard.

Display *XOpenDisplay(name)  /* open a display on the named server.
                                If successful  then all the screens on 
                                the display may be used . */
    char *name;              /* e.g. mit-athena:0.0*/

XCloseDisplay(display)       /* close a display completely */
When a client's connection to a display is closed, the resources held by the server solely on the client's behalf are freed. When the last connection to the X server is closed, more resources are freed and the server does a reset.

Tim Love
Mon Mar 11 17:03:18 GMT 1996