1XCreateWindow(3X11)             XLIB FUNCTIONS             XCreateWindow(3X11)
2
3
4

NAME

6       XCreateWindow, XCreateSimpleWindow, XSetWindowAttributes - create win‐
7       dows and window attributes structure
8

SYNTAX

10       Window XCreateWindow(Display *display, Window parent, int x, int y,
11              unsigned int width, unsigned int height, unsigned int bor‐
12              der_width, int depth, unsigned int class, Visual *visual,
13              unsigned long valuemask, XSetWindowAttributes *attributes);
14
15       Window XCreateSimpleWindow(Display *display, Window parent, int x, int
16              y, unsigned int width, unsigned int height, unsigned int bor‐
17              der_width, unsigned long border, unsigned long background);
18

ARGUMENTS

20       attributes
21                 Specifies the structure from which the values (as specified
22                 by the value mask) are to be taken.  The value mask should
23                 have the appropriate bits set to indicate which attributes
24                 have been set in the structure.
25
26       background
27                 Specifies the background pixel value of the window.
28
29
30       border    Specifies the border pixel value of the window.
31
32       border_width
33                 Specifies the width of the created window's border in pixels.
34
35       class     Specifies the created window's class.  You can pass InputOut‐
36                 put, InputOnly, or CopyFromParent.  A class of CopyFromParent
37                 means the class is taken from the parent.
38
39       depth     Specifies the window's depth.  A depth of CopyFromParent
40                 means the depth is taken from the parent.
41
42       display   Specifies the connection to the X server.
43
44       parent    Specifies the parent window.
45
46       valuemask Specifies which window attributes are defined in the
47                 attributes argument.  This mask is the bitwise inclusive OR
48                 of the valid attribute mask bits.  If valuemask is zero, the
49                 attributes are ignored and are not referenced.
50
51       visual    Specifies the visual type.  A visual of CopyFromParent means
52                 the visual type is taken from the parent.
53
54
55       width
56       height    Specify the width and height, which are the created window's
57                 inside dimensions and do not include the created window's
58                 borders.
59
60
61       x
62       y         Specify the x and y coordinates, which are the top-left out‐
63                 side corner of the window's borders and are relative to the
64                 inside of the parent window's borders.
65

DESCRIPTION

67       The XCreateWindow function creates an unmapped subwindow for a speci‐
68       fied parent window, returns the window ID of the created window, and
69       causes the X server to generate a CreateNotify event.  The created win‐
70       dow is placed on top in the stacking order with respect to siblings.
71
72       The coordinate system has the X axis horizontal and the Y axis vertical
73       with the origin [0, 0] at the upper-left corner.  Coordinates are inte‐
74       gral, in terms of pixels, and coincide with pixel centers.  Each window
75       and pixmap has its own coordinate system.  For a window, the origin is
76       inside the border at the inside, upper-left corner.
77
78       The border_width for an InputOnly window must be zero, or a BadMatch
79       error results.  For class InputOutput, the visual type and depth must
80       be a combination supported for the screen, or a BadMatch error results.
81       The depth need not be the same as the parent, but the parent must not
82       be a window of class InputOnly, or a BadMatch error results.  For an
83       InputOnly window, the depth must be zero, and the visual must be one
84       supported by the screen.  If either condition is not met, a BadMatch
85       error results.  The parent window, however, may have any depth and
86       class.  If you specify any invalid window attribute for a window, a
87       BadMatch error results.
88
89       The created window is not yet displayed (mapped) on the user's display.
90       To display the window, call XMapWindow.  The new window initially uses
91       the same cursor as its parent.  A new cursor can be defined for the new
92       window by calling XDefineCursor.  The window will not be visible on the
93       screen unless it and all of its ancestors are mapped and it is not
94       obscured by any of its ancestors.
95
96       XCreateWindow can generate BadAlloc BadColor, BadCursor, BadMatch, Bad‐
97       Pixmap, BadValue, and BadWindow errors.
98
99       The XCreateSimpleWindow function creates an unmapped InputOutput sub‐
100       window for a specified parent window, returns the window ID of the cre‐
101       ated window, and causes the X server to generate a CreateNotify event.
102       The created window is placed on top in the stacking order with respect
103       to siblings.  Any part of the window that extends outside its parent
104       window is clipped.  The border_width for an InputOnly window must be
105       zero, or a BadMatch error results.  XCreateSimpleWindow inherits its
106       depth, class, and visual from its parent.  All other window attributes,
107       except background and border, have their default values.
108
109       XCreateSimpleWindow can generate BadAlloc, BadMatch, BadValue, and Bad‐
110       Window errors.
111

STRUCTURES

113       The XSetWindowAttributes structure contains:
114
115       /∗ Window attribute value mask bits */
116
117       #define   CWBackPixmap                (1L<<0)
118       #define   CWBackPixel                 (1L<<1)
119       #define   CWBorderPixmap              (1L<<2)
120       #define   CWBorderPixel               (1L<<3)
121       #define   CWBitGravity                (1L<<4)
122       #define   CWWinGravity                (1L<<5)
123       #define   CWBackingStore              (1L<<6)
124       #define   CWBackingPlanes             (1L<<7)
125       #define   CWBackingPixel              (1L<<8)
126       #define   CWOverrideRedirect          (1L<<9)
127       #define   CWSaveUnder                 (1L<<10)
128       #define   CWEventMask                 (1L<<11)
129       #define   CWDontPropagate             (1L<<12)
130       #define   CWColormap                  (1L<<13)
131       #define   CWCursor                    (1L<<14)
132       /∗ Values */
133
134       typedef struct {
135            Pixmap background_pixmap;/∗ background, None, or ParentRelative */
136            unsigned long background_pixel;/∗ background pixel */
137            Pixmap border_pixmap;    /∗ border of the window or CopyFromParent */
138            unsigned long border_pixel;/∗ border pixel value */
139            int bit_gravity;         /∗ one of bit gravity values */
140            int win_gravity;         /∗ one of the window gravity values */
141            int backing_store;       /∗ NotUseful, WhenMapped, Always */
142            unsigned long backing_planes;/∗ planes to be preserved if possible */
143            unsigned long backing_pixel;/∗ value to use in restoring planes */
144            Bool save_under;         /∗ should bits under be saved? (popups) */
145            long event_mask;         /∗ set of events that should be saved */
146            long do_not_propagate_mask;/∗ set of events that should not propagate */
147            Bool override_redirect;  /∗ boolean value for override_redirect */
148            Colormap colormap;       /∗ color map to be associated with window */
149            Cursor cursor;           /∗ cursor to be displayed (or None) */
150       } XSetWindowAttributes;
151
152       For a detailed explanation of the members of this structure, see Xlib -
153       C Language X Interface.
154

DIAGNOSTICS

156       BadAlloc  The server failed to allocate the requested resource or
157                 server memory.
158
159       BadColor  A value for a Colormap argument does not name a defined Col‐
160                 ormap.
161
162       BadCursor A value for a Cursor argument does not name a defined Cursor.
163
164       BadMatch  The values do not exist for an InputOnly window.
165
166       BadMatch  Some argument or pair of arguments has the correct type and
167                 range but fails to match in some other way required by the
168                 request.
169
170       BadPixmap A value for a Pixmap argument does not name a defined Pixmap.
171
172       BadValue  Some numeric value falls outside the range of values accepted
173                 by the request.  Unless a specific range is specified for an
174                 argument, the full range defined by the argument's type is
175                 accepted.  Any argument defined as a set of alternatives can
176                 generate this error.
177
178       BadWindow A value for a Window argument does not name a defined Window.
179

SEE ALSO

181       XChangeWindowAttributes(3X11), XConfigureWindow(3X11), XDefineCur‐
182       sor(3X11), XDestroyWindow(3X11), XMapWindow(3X11), XRaiseWindow(3X11),
183       XUnmapWindow(3X11)
184       Xlib - C Language X Interface
185
186
187
188X Version 11                     libX11 1.0.3              XCreateWindow(3X11)
Impressum