XCreateWindow(3X11) MIT X11R4 XCreateWindow(3X11)
Name
XCreateWindow, XCreateSimpleWindow, XSetWindowAttributes - create windows and window attributes structure
Syntax
Window XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valuemask, attributes)
Display *display;
Window parent;
int x, y;
unsigned int width, height;
unsigned int border_width;
int depth;
unsigned int class;
Visual *visual
unsigned long valuemask;
XSetWindowAttributes *attributes;
Window XCreateSimpleWindow(display, parent, x, y, width, height, border_width, border, background)
Display *display;
Window parent;
int x, y;
unsigned int width, height;
unsigned int border_width;
unsigned long border;
unsigned long background;
Arguments
attributes
Specifies the structure from which the values (as specified by the value mask) are to be taken. The value mask should have the
appropriate bits set to indicate which attributes have been set in the structure.
background
Specifies the background pixel value of the window.
border Specifies the border pixel value of the window.
border_width
Specifies the width of the created window's border in pixels.
class Specifies the created window's class. You can pass or A class of means the class is taken from the parent.
depth Specifies the window's depth. A depth of means the depth is taken from the parent.
display Specifies the connection to the X server.
parent Specifies the parent window.
valuemask Specifies which window attributes are defined in the attributes argument. This mask is the bitwise inclusive OR of the valid
attribute mask bits. If valuemask is zero, the attributes are ignored and are not referenced.
visual Specifies the visual type. A visual of means the visual type is taken from the parent.
width
height Specify the width and height, which are the created window's inside dimensions and do not include the created window's borders.
x
y Specify the x and y coordinates, which are the top-left outside corner of the window's borders and are relative to the inside of
the parent window's borders.
Description
The function creates an unmapped subwindow for a specified parent window, returns the window ID of the created window, and causes the X
server to generate a event. The created window is placed on top in the stacking order with respect to siblings.
The border_width for an window must be zero, or a error results. For class the visual type and depth must be a combination supported for
the screen, or a error results. The depth need not be the same as the parent, but the parent must not be a window of class or a error
results. For an window, the depth must be zero, and the visual must be one supported by the screen. If either condition is not met, a
error results. The parent window, however, may have any depth and class. If you specify any invalid window attribute for a window, a
error results.
The created window is not yet displayed (mapped) on the user's display. To display the window, call The new window initially uses the same
cursor as its parent. A new cursor can be defined for the new window by calling The window will not be visible on the screen unless it and
all of its ancestors are mapped and it is not obscured by any of its ancestors.
can generate and errors.
The function creates an unmapped subwindow for a specified parent window, returns the window ID of the created window, and causes the X
server to generate a event. The created window is placed on top in the stacking order with respect to siblings. Any part of the window
that extends outside its parent window is clipped. The border_width for an window must be zero, or a error results. inherits its depth,
class, and visual from its parent. All other window attributes, except background and border, have their default values.
can generate and errors.
Structures
The structure contains:
/* Window attribute value mask bits */
#define (1L<<0)
#define (1L<<1)
#define (1L<<2)
#define (1L<<3)
#define (1L<<4)
#define (1L<<5)
#define (1L<<6)
#define (1L<<7)
#define (1L<<8)
#define (1L<<9)
#define (1L<<10)
#define (1L<<11)
#define (1L<<12)
#define (1L<<13)
#define (1L<<14)
/* Values */
typedef struct {
Pixmap background_pixmap; /* background,None,
ParentRelative */
unsigned long background_pixel; /* background pixel */
Pixmap border_pixmap; /* window borderor
CopyFromParent */
unsigned long border_pixel; /* border pixel value */
int bit_gravity; /* a bit gravity value */
int win_gravity; /* a window gravity value */
int backing_store; /* NotUseful, WhenMapped,
Always */
unsigned long backing_planes; /* planes to preserve if
possible */
unsigned long backing_pixel; /* value to use in restoring
planes*/
Bool save_under; /* should bits under be
saved? */
long event_mask; /* set of events to be saved */
long do_not_propagate_mask; /* set of events that should
not propagate */
Bool override_redirect; /* boolean value for
override_redirect */
Colormap colormap; /* color map to be associated
with window */
Cursor cursor; /* cursor to be displayed
(or None) */
} XSetWindowAttributes;
For a detailed explanation of the members of this structure, see X Window System: The Complete Reference, Second Edition, Robert W. Schei-
fler and James Gettys.
Diagnostics
The server failed to allocate the requested resource or server memory.
A value for a Colormap argument does not name a defined Colormap.
A value for a Cursor argument does not name a defined Cursor.
The values do not exist for an
window.
Some argument or pair of arguments has the correct type and range but fails
to match in some other way required by the request.
A value for a Pixmap argument does not name a defined Pixmap.
Some numeric value falls outside the range of values accepted by the request.
Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument
defined as a set of alternatives can generate this error.
A value for a Window argument does not name a defined Window.
See Also
XChangeWindowAttributes(3X11), XConfigureWindow(3X11), XDefineCursor(3X11), XDestroyWindow(3X11), XMapWindow(3X11), XRaiseWindow(3X11),
XUnmapWindow(3X11)
X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys
XCreateWindow(3X11)