NAME

XCreateWindow, XCreateSimpleWindow, XSetWindowAttributes - create windows and window attributes structure

SYNTAX

Window XCreateWindow(Display *_d_i_s_p_l_a_y, Window _p_a_r_e_n_t, int _x, int _y, unsigned int _w_i_d_t_h, unsigned int _h_e_i_g_h_t, unsigned int _b_o_r_d_e_r___w_i_d_t_h, int _d_e_p_t_h, unsigned int _c_l_a_s_s, Visual *_v_i_s_u_a_l, unsigned long _v_a_l_u_e_m_a_s_k, XSetWindowAttributes *_a_t_t_r_i_b_u_t_e_s); Window XCreateSimpleWindow(Display *_d_i_s_p_l_a_y, Window _p_a_r_e_n_t, int _x, int _y, unsigned int _w_i_d_t_h, unsigned int _h_e_i_g_h_t, unsigned int _b_o_r_d_e_r___w_i_d_t_h, unsigned long _b_o_r_d_e_r, unsigned long _b_a_c_k_g_r_o_u_n_d);

ARGUMENTS

_a_t_t_r_i_b_u_t_e_s 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.
_b_a_c_k_g_r_o_u_n_d Specifies the background pixel value of the window.

_b_o_r_d_e_r Specifies the border pixel value of the window.
_b_o_r_d_e_r___w_i_d_t_h Specifies the width of the created window's border in pixels.
_c_l_a_s_s Specifies the created window's class.
You can pass _I_n_p_u_t_O_u_t_p_u_t, _I_n_p_u_t_O_n_l_y, or _C_o_p_y_F_r_o_m_P_a_r_e_n_t. A class of _C_o_p_y_F_r_o_m_P_a_r_e_n_t means the class is taken from the parent.
_d_e_p_t_h Specifies the window's depth.
A depth of _C_o_p_y_F_r_o_m_P_a_r_e_n_t means the depth is taken from the parent.
_d_i_s_p_l_a_y Specifies the connection to the X server.
_p_a_r_e_n_t Specifies the parent window.
_v_a_l_u_e_m_a_s_k 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.
_v_i_s_u_a_l Specifies the visual type.
A visual of _C_o_p_y_F_r_o_m_P_a_r_e_n_t means the visual type is taken from the parent. and do not include the created window's borders
_w_i_d_t_h
_h_e_i_g_h_t Specify the width and height, which are the created window's inside dimensions.
borders and are relative to the inside of the parent window's borders
_x
_y Specify the x and y coordinates, which are the top-left outside corner of the window's.

DESCRIPTION

The _X_C_r_e_a_t_e_W_i_n_d_o_w 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 _C_r_e_a_t_e_N_o_t_i_f_y event. The created window is placed on top in the stacking order with respect to siblings.

The coordinate system has the X axis horizontal and the Y axis vertical with the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms of pixels, and coincide with pixel centers. Each window and pixmap has its own coordinate system. For a window, the origin is inside the border at the inside, upper-left corner.

The border_width for an _I_n_p_u_t_O_n_l_y window must be zero, or a _B_a_d_M_a_t_c_h error results. For class _I_n_p_u_t_O_u_t_p_u_t, the visual type and depth must be a combination supported for the screen, or a _B_a_d_M_a_t_c_h error results. The depth need not be the same as the parent, but the parent must not be a window of class _I_n_p_u_t_O_n_l_y, or a _B_a_d_M_a_t_c_h error results. For an _I_n_p_u_t_O_n_l_y window, the depth must be zero, and the visual must be one supported by the screen. If either condition is not met, a _B_a_d_M_a_t_c_h error results. The parent window, however, may have any depth and class. If you specify any invalid window attribute for a window, a _B_a_d_M_a_t_c_h error results.

The created window is not yet displayed (mapped) on the user's display. To display the window, call _X_M_a_p_W_i_n_d_o_w. The new window initially uses the same cursor as its parent. A new cursor can be defined for the new window by calling _X_D_e_f_i_n_e_C_u_r_s_o_r. 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.

_X_C_r_e_a_t_e_W_i_n_d_o_w can generate _B_a_d_A_l_l_o_c _B_a_d_C_o_l_o_r, _B_a_d_C_u_r_s_o_r, _B_a_d_M_a_t_c_h, _B_a_d_P_i_x_m_a_p, _B_a_d_V_a_l_u_e, and _B_a_d_W_i_n_d_o_w errors.

The _X_C_r_e_a_t_e_S_i_m_p_l_e_W_i_n_d_o_w function creates an unmapped _I_n_p_u_t_O_u_t_p_u_t subwindow for a specified parent window, returns the window ID of the created window, and causes the X server to generate a _C_r_e_a_t_e_N_o_t_i_f_y 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 _I_n_p_u_t_O_n_l_y window must be zero, or a _B_a_d_M_a_t_c_h error results. _X_C_r_e_a_t_e_S_i_m_p_l_e_W_i_n_d_o_w inherits its depth, class, and visual from its parent. All other window attributes, except background and border, have their default values.

_X_C_r_e_a_t_e_S_i_m_p_l_e_W_i_n_d_o_w can generate _B_a_d_A_l_l_o_c, _B_a_d_M_a_t_c_h, _B_a_d_V_a_l_u_e, and _B_a_d_W_i_n_d_o_w errors.

STRUCTURES

The _X_S_e_t_W_i_n_d_o_wAttributes structure contains:

/* Window attribute value mask bits */

lw(.5i) lw(2.5i) lw(.8i).
T{
#define
T}      T{
_C_W_B_a_c_k_P_i_x_m_a_p
T}      T{
(1L<<0)
T}
T{
#define
T}      T{
_C_W_B_a_c_k_P_i_x_e_l
T}      T{
(1L<<1)
T}
T{
#define
T}      T{
_C_W_B_o_r_d_e_r_P_i_x_m_a_p
T}      T{
(1L<<2)
T}
T{
#define
T}      T{
_C_W_B_o_r_d_e_r_P_i_x_e_l
T}      T{
(1L<<3)
T}
T{
#define
T}      T{
_C_W_B_i_t_G_r_a_v_i_t_y
T}      T{
(1L<<4)
T}
T{
#define
T}      T{
_C_W_W_i_n_G_r_a_v_i_t_y
T}      T{
(1L<<5)
T}
T{
#define
T}      T{
_C_W_B_a_c_k_i_n_g_S_t_o_r_e
T}      T{
(1L<<6)
T}
T{
#define
T}      T{
_C_W_B_a_c_k_i_n_g_P_l_a_n_e_s
T}      T{
(1L<<7)
T}
T{
#define
T}      T{
_C_W_B_a_c_k_i_n_g_P_i_x_e_l
T}      T{
(1L<<8)
T}
T{
#define
T}      T{
_C_W_O_v_e_r_r_i_d_e_R_e_d_i_r_e_c_t
T}      T{
(1L<<9)
T}
T{
#define
T}      T{
_C_W_S_a_v_e_U_n_d_e_r
T}      T{
(1L<<10)
T}
T{
#define
T}      T{
_C_W_E_v_e_n_t_M_a_s_k
T}      T{
(1L<<11)
T}
T{
#define
T}      T{
_C_W_D_o_n_t_P_r_o_p_a_g_a_t_e
T}      T{
(1L<<12)
T}
T{
#define
T}      T{
_C_W_C_o_l_o_r_m_a_p
T}      T{
(1L<<13)
T}
T{
#define
T}      T{
_C_W_C_u_r_s_o_r
T}      T{
(1L<<14)
T}

/* Values */

typedef struct { Pixmap background_pixmap;/* background, None, or ParentRelative */ unsigned long background_pixel;/* background pixel */ Pixmap border_pixmap; /* border of the window or CopyFromParent */ unsigned long border_pixel;/* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preserved if possible */ unsigned long backing_pixel;/* value to use in restoring planes */ Bool save_under; /* should bits under be saved? (popups) */ long event_mask; /* set of events that should 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_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e.

DIAGNOSTICS

_B_a_d_A_l_l_o_c
The server failed to allocate the requested resource or server memory.
_B_a_d_C_o_l_o_r
A value for a Colormap argument does not name a defined Colormap.
_B_a_d_C_u_r_s_o_r
A value for a Cursor argument does not name a defined Cursor.
_B_a_d_M_a_t_c_h
The values do not exist for an _I_n_p_u_t_O_n_l_y window.
_B_a_d_M_a_t_c_h
Some argument or pair of arguments has the correct type and range but fails to match in some other way required by the request.
_B_a_d_P_i_x_m_a_p
A value for a Pixmap argument does not name a defined Pixmap.
_B_a_d_V_a_l_u_e
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.
_B_a_d_W_i_n_d_o_w
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_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e