next up previous contents
Next: Creating & Destroying Windows Up: Starting Up Previous: Opening a Display Server

Finding out about the display

Some simple routines can be used to discover general characteristics of the display. These shall be described in some detail as an introduction to some X concepts.

int DefaultScreen(display)  /* This returns the default screen number; the only */
                             /* one you're likely to use */

int ScreenCount(display)    /* This returns the number of possible screens */ 

int  DefaultDepth()         /* A graphics display can be thought of as overlying  
                              bitplanes where only one bit per plane affects the 
                              color of a pixel. This routine returns the number  
                              of planes used */

unsigned long AllPlanes()   /* The bits in the returned long
                             represent the planes used */

int DisplayPlanes(display, screen_number) /* returns the number of possible planes*/

Colormap DefaultColormap(display, screen_number) /* Information on the current 
                       colors is stored in a table called a colormap */

int DisplayCells(display, screen_number) /* returns number of entries in the  
                                          default colormap */

unsigned long BlackPixel(display, screen_number) /* There are permanently */
unsigned long WhitePixel(display, screen_number) /* allocated entries in  
    the default colormap for black and white. These routines return 
    longs that are used to reference these colors */

GC DefaultGC(display, screen_number)  /* Graphics commands get details about
    the current  foreground color, etc, from a Graphics Context structure.
    This  routine returns the default one */

Window DefaultRootWindow(display)     /* This returns the initial window that
                                       covers the screen */

Visual *DefaultVisual(display,screen_number) /* So that various kinds of hardware 
    can be supported `invisibly', some  hardware-specific information
    is stored in the visual structure*/

int DisplayHeight(display,screen_number)    /* height of display in pixels */

int DisplayWidth(display,screen_number)     /* width of display in pixels */



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